From d61adb0b0c95d7d856792c5eab6cdeb75d92f9f2 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Fri, 8 Dec 2023 21:13:44 +0100 Subject: [PATCH] Leds animation refactoring stage 1 (#20197) --- .../src/internal/NeoEsp32RmtMethod_idf5.h | 4 +- .../src/internal/NeoEsp32SpiMethod_idf5.h | 9 +- lib/libesp32/berry/default/be_modtab.c | 4 + ...nimator_lib.c => be_leds_animator_class.c} | 0 .../berry_tasmota/src/be_leds_frame_lib.c | 39 + .../berry_tasmota/src/be_leds_ntv_lib.c | 51 +- .../berry_tasmota/src/be_leds_pulse_class.c | 9 + .../src/embedded/animate_module.be | 441 ++- .../berry_tasmota/src/embedded/leds.be | 42 +- .../src/embedded/leds_animate_effects.be | 162 + .../src/embedded/leds_animator.be | 119 +- .../src/embedded/leds_frame_be_methods.be | 28 + .../src/solidify/solidified_animate_module.h | 1769 ++++++++--- .../src/solidify/solidified_leds.h | 2775 +++++++++-------- .../solidified_leds_animate_effects.h | 358 +++ .../src/solidify/solidified_leds_animator.h | 891 ++++-- .../solidified_leds_frame_be_methods.h | 186 ++ .../leds_animate_demo_palette_background.be | 51 + .../xdrv_52_3_berry_leds.ino | 255 +- 19 files changed, 4942 insertions(+), 2251 deletions(-) rename lib/libesp32/berry_tasmota/src/{be_leds_animator_lib.c => be_leds_animator_class.c} (100%) create mode 100644 lib/libesp32/berry_tasmota/src/be_leds_frame_lib.c create mode 100644 lib/libesp32/berry_tasmota/src/be_leds_pulse_class.c create mode 100644 lib/libesp32/berry_tasmota/src/embedded/leds_animate_effects.be create mode 100644 lib/libesp32/berry_tasmota/src/embedded/leds_frame_be_methods.be create mode 100644 lib/libesp32/berry_tasmota/src/solidify/solidified_leds_animate_effects.h create mode 100644 lib/libesp32/berry_tasmota/src/solidify/solidified_leds_frame_be_methods.h create mode 100644 tasmota/berry/leds/leds_animate_demo_palette_background.be diff --git a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod_idf5.h b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod_idf5.h index 78b89390d..a86b05330 100644 --- a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod_idf5.h +++ b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod_idf5.h @@ -529,7 +529,9 @@ public: // ESP_LOGI(TAG, "Enable RMT TX channel"); ret += rmt_enable(_channel.RmtChannelNumber); - AddLog(2,"RMT:initialized with error code: %u on pin: %u",ret, _pin); + // if (ret) { + // AddLog(2,"RMT: initialized with error code: %u on pin: %u",ret, _pin); + // } } void Update(bool maintainBufferConsistency) diff --git a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32SpiMethod_idf5.h b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32SpiMethod_idf5.h index 826d6ef99..b546ec845 100644 --- a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32SpiMethod_idf5.h +++ b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32SpiMethod_idf5.h @@ -328,8 +328,9 @@ public: _spi_strip->bytes_per_pixel = bytes_per_pixel; _spi_strip->strip_len = _pixelCount; - - AddLog(2,"SPI:initialized with error code: %u on pin: %u",ret, _pin); + // if (ret) { + // AddLog(2,"SPI: initialized with error code: %u on pin: %u",ret, _pin); + // } return; err: if (_spi_strip) { @@ -341,7 +342,9 @@ public: } free(_spi_strip); } - AddLog(2,"SPI-Error:initialized with error code: %u on pin: %u",ret, _pin); + // if (ret) { + // AddLog(2,"SPI-Error:initialized with error code: %u on pin: %u",ret, _pin); + // } return; } diff --git a/lib/libesp32/berry/default/be_modtab.c b/lib/libesp32/berry/default/be_modtab.c index 121ccff49..0333db5ea 100644 --- a/lib/libesp32/berry/default/be_modtab.c +++ b/lib/libesp32/berry/default/be_modtab.c @@ -206,8 +206,10 @@ be_extern_native_class(AXP192); be_extern_native_class(AXP202); be_extern_native_class(OneWire); be_extern_native_class(Leds_ntv); +be_extern_native_class(Leds_frame); be_extern_native_class(Leds); be_extern_native_class(Leds_animator); +be_extern_native_class(Leds_pulse); be_extern_native_class(AudioGenerator); be_extern_native_class(AudioFileSource); be_extern_native_class(AudioOutputI2S); @@ -276,7 +278,9 @@ BERRY_LOCAL bclass_array be_class_table = { #ifdef USE_WS2812 &be_native_class(Leds_ntv), &be_native_class(Leds), + &be_native_class(Leds_frame), &be_native_class(Leds_animator), + &be_native_class(Leds_pulse), #endif // USE_WS2812 #ifdef USE_ENERGY_SENSOR &be_native_class(energy_struct), diff --git a/lib/libesp32/berry_tasmota/src/be_leds_animator_lib.c b/lib/libesp32/berry_tasmota/src/be_leds_animator_class.c similarity index 100% rename from lib/libesp32/berry_tasmota/src/be_leds_animator_lib.c rename to lib/libesp32/berry_tasmota/src/be_leds_animator_class.c diff --git a/lib/libesp32/berry_tasmota/src/be_leds_frame_lib.c b/lib/libesp32/berry_tasmota/src/be_leds_frame_lib.c new file mode 100644 index 000000000..a1b1c353b --- /dev/null +++ b/lib/libesp32/berry_tasmota/src/be_leds_frame_lib.c @@ -0,0 +1,39 @@ +/******************************************************************** + * Berry class `neopixelbus_ntv` + * + *******************************************************************/ + +#include "be_constobj.h" + +#ifdef USE_WS2812 + +extern int be_leds_blend(bvm *vm); +extern int be_leds_blend_pixels(bvm *vm); +extern int be_leds_fill_pixels(bvm *vm); +extern int be_leds_paste_pixels(bvm *vm); + +BE_EXPORT_VARIABLE extern const bclass be_class_bytes; + +#include "solidify/solidified_leds_frame_be_methods.h" + +/* @const_object_info_begin +class be_class_Leds_frame (scope: global, name: Leds_frame, super:be_class_bytes, strings: weak) { + pixel_size, var + + init, closure(Leds_frame_be_init_closure) + + item, closure(Leds_frame_be_item_closure) + setitem, closure(Leds_frame_be_setitem_closure) + set_pixel, closure(Leds_frame_be_set_pixel_closure) + + // the following are on buffers + blend, static_func(be_leds_blend) + fill_pixels, func(be_leds_fill_pixels) + blend_pixels, func(be_leds_blend_pixels) + paste_pixels, func(be_leds_paste_pixels) +} +@const_object_info_end */ + +#include "be_fixed_be_class_Leds_frame.h" + +#endif // USE_WS2812 diff --git a/lib/libesp32/berry_tasmota/src/be_leds_ntv_lib.c b/lib/libesp32/berry_tasmota/src/be_leds_ntv_lib.c index 5197df2e0..26ff0b69b 100644 --- a/lib/libesp32/berry_tasmota/src/be_leds_ntv_lib.c +++ b/lib/libesp32/berry_tasmota/src/be_leds_ntv_lib.c @@ -1,50 +1,31 @@ /******************************************************************** - * Berry class `neopixelbus_ntv` + * Berry class `Leds_ntv` * *******************************************************************/ -/* -class Leds_ntv - var _p # pointer to internal object of type `NeoPixelBus(uint16_t countPixels, uint8_t pin)` - var _t # type of led strip - static WS2812_GRB = 1 - static SK6812_GRBW = 2 - - # skeleton for native call - def call_native() end -end - -*/ #include "be_constobj.h" #ifdef USE_WS2812 extern int be_neopixelbus_call_native(bvm *vm); +extern int be_leds_blend_color(bvm *vm); +extern int be_leds_apply_bri_gamma(bvm *vm); +/* @const_object_info_begin +class be_class_Leds_ntv (scope: global, name: Leds_ntv, strings: weak) { + _p, var + _t, var -/******************************************************************** -** Solidified class: Leds_ntv -********************************************************************/ -be_local_class(Leds_ntv, - 2, - NULL, - be_nested_map(5, - ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(call_native, -1), be_const_func(be_neopixelbus_call_native) }, - { be_const_key(_t, -1), be_const_var(1) }, - { be_const_key(_p, 3), be_const_var(0) }, - { be_const_key(SK6812_GRBW, 4), be_const_int(2) }, - { be_const_key(WS2812_GRB, -1), be_const_int(1) }, - })), - be_str_weak(Leds_ntv) -); -/*******************************************************************/ + WS2812_GRB, int(1) + SK6812_GRBW, int(2) -void be_load_Leds_ntv_class(bvm *vm) { - be_pushntvclass(vm, &be_class_Leds_ntv); - be_setglobal(vm, "Leds_ntv"); - be_pop(vm, 1); + call_native, func(be_neopixelbus_call_native) + + blend_color, static_func(be_leds_blend_color) + apply_bri_gamma, static_func(be_leds_apply_bri_gamma) } +@const_object_info_end */ + +#include "be_fixed_be_class_Leds_ntv.h" -// be_const_func(be_neopixelbus_call_native) #endif // USE_WS2812 diff --git a/lib/libesp32/berry_tasmota/src/be_leds_pulse_class.c b/lib/libesp32/berry_tasmota/src/be_leds_pulse_class.c new file mode 100644 index 000000000..5b6e15bff --- /dev/null +++ b/lib/libesp32/berry_tasmota/src/be_leds_pulse_class.c @@ -0,0 +1,9 @@ +/******************************************************************** + * Berry class `Leds_pulse` + * + *******************************************************************/ +#ifdef USE_WS2812 + +#include "solidify/solidified_leds_animate_effects.h" + +#endif // USE_WS2812 diff --git a/lib/libesp32/berry_tasmota/src/embedded/animate_module.be b/lib/libesp32/berry_tasmota/src/embedded/animate_module.be index 7e913c919..f1857c90c 100644 --- a/lib/libesp32/berry_tasmota/src/embedded/animate_module.be +++ b/lib/libesp32/berry_tasmota/src/embedded/animate_module.be @@ -4,6 +4,7 @@ # Animation framework # +#@ solidify:animate,weak animate = module("animate") # state-machine: from val a to b @@ -20,6 +21,381 @@ class Animate_ins_ramp end animate.ins_ramp = Animate_ins_ramp + +################################################################################# +# class Animate_palette +# +# Animated color palette +################################################################################# + +################################################################################# +# Palette format compatible +# +# Takes a binary array with a set of 4 bytes elements: VRGB +# V: Value in a range 0..255. The first value must be 0, +# the last needs to be 255. +# Numbers must be in strictly increasin numbers. +# The algorithm maps a 0..255 rotating value to its color +# in the palette. +# R: Red component +# G: Green component +# B: Blue component +# Note: RGB is in big Endian to make it more readable, although +# it's little-endian when in memory. Be aware! +# RGB values are stored at max brightness and without gamma correction +################################################################################# + +# Gradient palette "ib_jul01_gp", originally from +# http://soliton.vm.bytemark.co.uk/pub/cpt-city/ing/xmas/tn/ib_jul01.png.index.html +var PALETTE_ib_jul01_gp = bytes( + "00" "E60611" + "5E" "25605A" + "85" "90BD6A" + "FF" "BB030D" +) +# animate.PALETTE_ib_jul01_gp = PALETTE_ib_jul01_gp +# rgb(230, 6, 17) 0.000%, +# rgb( 37, 96, 90) 37.010%, +# rgb(144,189,106) 52.000%, +# rgb(187, 3, 13) 100.000% + +var PALETTE_STANDARD_VAL = bytes( + "00" "FF0000" # red + "24" "FFA500" # orange + "49" "FFFF00" # yellow + "6E" "008800" # green + "92" "0000FF" # blue + "B7" "4B0082" # indigo + "DB" "EE82EE" # violet + "FF" "FF0000" # red +) +# animate.PALETTE_STANDARD = PALETTE_STANDARD + +var PALETTE_SATURATED_TAG = bytes( + "40" "FF0000" # red + "40" "FFA500" # orange + "40" "FFFF00" # yellow + "40" "00FF00" # green + "40" "0000FF" # blue + "40" "FF00FF" # indigo + "40" "EE44A5" # violet + "00" "FF0000" # red +) + +var PALETTE_STANDARD_TAG = bytes( + "40" "FF0000" # red + "40" "FFA500" # orange + "40" "FFFF00" # yellow + "40" "008800" # green + "40" "0000FF" # blue + "40" "4B0082" # indigo + "40" "EE82EE" # violet + "00" "FF0000" # red +) +# animate.PALETTE_STANDARD = PALETTE_STANDARD + + +class Animate_palette + # parsing of palette + var palette # raw bytes object + var slots_arr # constructed array of timestamp slots + var slots # number of slots + # timing information + var running + var duration_ms # duration_ms of the entire cycle in ms, cannot be `0` + var origin # origin in ms of the current cycle, as per tasmota.millis() reference + # range information (when used as range color) + var range_min # minimum value expected as input + var range_max # maximum value expected as input, needs (range_min < range_max, can be negative) + # callback information + var animate_obj # object to call + var animate_mth # object method to call + # brightness + var bri # brightness to be applied to palette 0..100 + # color object to do RGB color calculation + var color # instance of light_state, used for color calculation (reuse of object) + + def init(palette, duration_s) + self.running = false + self.palette = palette + self.bri = 100 + self.slots = size(palette) / 4 + if duration_s != nil + self.set_duration(int(duration_s * 1000)) + end + self.color = light_state(light_state.RGB) + end + + def set_cb(obj, mth) + self.animate_obj = obj + self.animate_mth = mth + end + + # setter to be used as cb + def set_bri(bri) + self.bri = int(bri) + end + + def start(millis) + if (self.duration_ms == nil) return end + if millis == nil millis = tasmota.millis() end + self.origin = millis + self.running = true + end + + def stop() + self.origin = nil + self.running = false + end + + def is_running() + return bool(self.running) + end + + def parse_palette(min, max) + var arr = [] + var slots = self.slots + arr.resize(slots) + + # check if we have slots or values + # if first value index is non-zero, it's ticks count + if self.palette.get(0, 1) != 0 + # palette in tick counts + # compute the total number of ticks + var total_ticks = 0 + var idx = 0 + while idx < slots - 1 + total_ticks += self.palette.get(idx * 4, 1) + idx += 1 + end + var cur_ticks = 0 + idx = 0 + while idx < slots + arr[idx] = tasmota.scale_int(cur_ticks, 0, total_ticks, min, max) + cur_ticks += self.palette.get(idx * 4, 1) + idx += 1 + end + else + # palette is in value range from 0..255 + var idx = 0 + while idx < slots + var val = self.palette.get(idx * 4, 1) + arr[idx] = tasmota.scale_int(val, 0, 255, min, max) + idx += 1 + end + end + # print(f"ANM: {arr=}") + return arr + end + + def set_duration(duration_ms) + if (duration_ms == nil) return end + if duration_ms <= 0 raise "value_error", "duration_ms must be positive" end + self.duration_ms = duration_ms + + self.slots_arr = self.parse_palette(0, duration_ms - 1) + end + + def set_range(min, max) + if (min >= max) raise "value_error", "min must be lower than mex" end + self.range_min = min + self.range_max = max + + self.slots_arr = self.parse_palette(min, max) + end + + # compute the css linear-gradient description + # + # Example: background: linear-gradient(to right, #000000, #e66465 11.0%, #9198e5); + def to_css_gradient() + var arr = self.parse_palette(0, 1000) + var ret = "background:linear-gradient(to right" + var idx = 0 + while idx < size(arr) + var prm = arr[idx] # per mile + + var bgrt = self.palette.get(idx * 4, 4) + var r = (bgrt >> 8) & 0xFF + var g = (bgrt >> 16) & 0xFF + var b = (bgrt >> 24) & 0xFF + ret += f",#{r:02X}{g:02X}{b:02X} {prm/10.0:.1f}%" + idx += 1 + end + ret += ");" + return ret + end + + def set_value(value) + if (self.range_min == nil || self.range_max == nil) return nil end + var scale_int = tasmota.scale_int + + # find slot + var slots = self.slots + var idx = slots - 2 + while idx > 0 + if value >= self.slots_arr[idx] break end + idx -= 1 + end + var bgrt0 = self.palette.get(idx * 4, 4) + var bgrt1 = self.palette.get((idx + 1) * 4, 4) + var t0 = self.slots_arr[idx] + var t1 = self.slots_arr[idx + 1] + var r = scale_int(value, t0, t1, (bgrt0 >> 8) & 0xFF, (bgrt1 >> 8) & 0xFF) + var g = scale_int(value, t0, t1, (bgrt0 >> 16) & 0xFF, (bgrt1 >> 16) & 0xFF) + var b = scale_int(value, t0, t1, (bgrt0 >> 24) & 0xFF, (bgrt1 >> 24) & 0xFF) + var rgb = (r << 16) | (g << 8) | b + # + var obj = self.animate_obj + var mth = self.animate_mth + if (obj && mth) + mth(obj, rgb) + end + # if self.cb != nil + # self.cb(rgb) + # end + # + # print(f"ANM: {rgb=:%06X}") + return rgb + end + + def animate(millis) + if (self.duration_ms == nil) return end + if millis == nil millis = tasmota.millis() end + var past = millis - self.origin + if past < 0 + past = 0 + millis = self.origin + end + var duration_ms = self.duration_ms + var scale_uint = tasmota.scale_uint + if past >= duration_ms + self.origin += (past / duration_ms) * duration_ms + past = past % duration_ms + end + # find slot + var slots = self.slots + var idx = slots - 2 + while idx > 0 + if past >= self.slots_arr[idx] break end + idx -= 1 + end + var bgrt0 = self.palette.get(idx * 4, 4) + var bgrt1 = self.palette.get((idx + 1) * 4, 4) + var t0 = self.slots_arr[idx] + var t1 = self.slots_arr[idx + 1] + var r = scale_uint(past, t0, t1, (bgrt0 >> 8) & 0xFF, (bgrt1 >> 8) & 0xFF) + var g = scale_uint(past, t0, t1, (bgrt0 >> 16) & 0xFF, (bgrt1 >> 16) & 0xFF) + var b = scale_uint(past, t0, t1, (bgrt0 >> 24) & 0xFF, (bgrt1 >> 24) & 0xFF) + + var color = self.color + color.set_rgb((bgrt0 >> 8) & 0xFF, (bgrt0 >> 16) & 0xFF, (bgrt0 >> 24) & 0xFF) + var bri0 = color.bri + color.set_rgb((bgrt1 >> 8) & 0xFF, (bgrt1 >> 16) & 0xFF, (bgrt1 >> 24) & 0xFF) + var bri1 = color.bri + var bri2 = scale_uint(past, t0, t1, bri0, bri1) + color.set_rgb(r, g, b) + color.set_bri(bri2) + + r = color.r + g = color.g + b = color.b + + # apply self.bri if not `100` + var bri = self.bri + if bri != 100 + r = tasmota.scale_uint(r, 0, 100, 0, bri) + g = tasmota.scale_uint(g, 0, 100, 0, bri) + b = tasmota.scale_uint(b, 0, 100, 0, bri) + end + + # var rgb = (r << 16) | (g << 8) | b + var rgb = (r << 16) | (g << 8) | b + + var obj = self.animate_obj + var mth = self.animate_mth + if (obj && mth) + mth(obj, rgb) + end + + return rgb + end +end +animate.palette = Animate_palette + +#- + +pal = Animate_palette(PALETTE_STANDARD_TAG, 7000) +pal = Animate_palette(PALETTE_STANDARD_VAL, 7000) + + +import animate +var pal = animate.palette(PALETTE_STANDARD_TAG, 7000) +pal.start(0) +for t: range(0,8000,200) + pal.tick(t) +end + +-# + +################################################################################# +# class Animate_segment +# +# Animate a small segment ______/+++\______ +# length in 1/256 pixels +# slew in 1/256 pixels +# fore foregroung color +# back background color (or transparent) +# origin in 1/256 pixels +# +# strip +################################################################################# +# class Animate_segment +# var strip +# var length +# var slew +# var fore +# var back +# var origin + +# def init(strip) +# self.strip = strip +# self.length = 256 # 1 pixel +# self.slew = 0 # 0 pixel (immediate) +# self.fore = 0x00FF0000 # red opaque +# self.back = 0xFF000000 # transparent +# self.origin = 0 # start of strip +# end + +# def paint(bri) +# # move all important values in registers +# var strip = self.strip +# var pix_offset = strip.pixel_offset() +# var pix_count = strip.pixel_count() +# var pix_buffer = strip.pixels_buffer() +# var pix_size = strip.pixel_size() + +# var length = self.length +# var slew = self.slew +# var fore = self.fore +# var back = self.back +# var origin = self.origin + +# var pix = 0 # iterate on each pixel +# var limit_low = (origin - slew) / 256 +# var limit_high = (origin + length + slew) / 256 +# while pix < pix_count +# # are we off limits +# if (pix >= limit_low) && (pix <= limit_high) # outside of those boundaries, we just apply backgroung +# strip.set_pixel_color(pix, fore, bri) +# else +# strip.set_pixel_color(pix, back, bri) +# end +# pix += 1 +# end +# end +# end +# animate.segment = Animate_segment + # state-machine: pause and goto class Animate_ins_goto var pc_rel # relative PC, -1 previous instruction, 1 next instruction, 0 means see pc_abs @@ -37,6 +413,8 @@ animate.ins_goto = Animate_ins_goto class Animate_engine var code # array of state-machine instructions var closure # closure to call with the new value + var animate_obj # object to call (alternative to closure) + var animate_mth # method to call on object var pc # program-counter var ins_time # absolute time when the current instruction started var running # is the animation running? allows fast return @@ -50,37 +428,35 @@ class Animate_engine # end - # run but needs external calls to `animate()` + def set_cb(obj, mth) + self.animate_obj = obj + self.animate_mth = mth + end + + # start but needs external calls to `animate()` # cur_time:int (opt) current timestamp in ms, defaults to `tasmota.millis()` # val:int (opt) starting value, default to `nil` - def run(cur_time, val) + def start(cur_time, val) if cur_time == nil cur_time = tasmota.millis() end if (val != nil) self.value = val end self.ins_time = cur_time self.running = true - tasmota.add_driver(self) end - # runs autonomously in the Tasmota event loop - def autorun(cur_time, val) - self.run(cur_time, val) - tasmota.add_driver(self) - end + # # runs autonomously in the Tasmota event loop + # def autorun(cur_time, val) + # self.run(cur_time, val) + # end def stop() self.running = false - tasmota.remove_driver(self) end def is_running() return self.running end - def every_50ms() - self.animate() - end - def animate(cur_time) # time in milliseconds, optional, defaults to `tasmota.millis()` if !self.running return end if cur_time == nil cur_time = tasmota.millis() end @@ -99,16 +475,23 @@ class Animate_engine # Instruction Ramp if isinstance(ins, animate.ins_ramp) - var f = self.closure # assign to a local variable to not call a method + var closure = self.closure # assign to a local variable to not call a method + var obj = self.animate_obj + var mth = self.animate_mth if sub_index < ins.duration # we're still in the ramp self.value = tasmota.scale_uint(sub_index, 0, ins.duration, ins.a, ins.b) + # call method + if (obj && mth) mth(obj, self.value) end # call closure - if f f(self.value) end # call closure, need try? TODO + if (closure) closure(self.value) end # call closure, need try? TODO break else self.value = ins.b - if f f(self.value) end # set to last value + # call method + if (obj && mth) mth(obj, self.value) end + # call closure + if (closure) closure(self.value) end # set to last value self.pc += 1 # next instruction self.ins_time = cur_time - (sub_index - ins.duration) end @@ -139,25 +522,26 @@ animate.engine = Animate_engine class Animate_from_to : Animate_engine - def init(closure, from, to, duration) + def init(obj, mth, from, to, duration) super(self).init() - self.closure = closure + self.set_cb(obj, mth) self.code.push(animate.ins_ramp(from, to, duration)) end end animate.from_to = Animate_from_to -#- -a=Animate_from_to(nil, 0, 100, 5000) -a.autorun() --# +### +# +# a=Animate_from_to(nil, 0, 100, 5000) +# +### class Animate_rotate : Animate_engine - def init(closure, from, to, duration) + def init(obj, mth, from, to, duration) super(self).init() - self.closure = closure + self.set_cb(obj, mth) self.code.push(animate.ins_ramp(from, to, duration)) self.code.push(animate.ins_goto(0, 0, 0)) # goto abs pc = 0 without any pause end @@ -172,17 +556,16 @@ a.autorun() class Animate_back_forth : Animate_engine - def init(closure, from, to, duration) + def init(obj, mth, from, to, duration) super(self).init() - self.closure = closure - self.code.push(animate.ins_ramp(from, to, duration / 2)) - self.code.push(animate.ins_ramp(to, from, duration / 2)) + self.set_cb(obj, mth) + self.code.push(animate.ins_ramp(from, to, duration)) + self.code.push(animate.ins_ramp(to, from, duration)) self.code.push(animate.ins_goto(0, 0, 0)) # goto abs pc = 0 without any pause end end animate.back_forth = Animate_back_forth -#@ solidify:animate #- a=Animate_back_forth(nil, 0, 100, 5000) diff --git a/lib/libesp32/berry_tasmota/src/embedded/leds.be b/lib/libesp32/berry_tasmota/src/embedded/leds.be index ecde9b706..3e20b1c4a 100644 --- a/lib/libesp32/berry_tasmota/src/embedded/leds.be +++ b/lib/libesp32/berry_tasmota/src/embedded/leds.be @@ -132,6 +132,9 @@ class Leds : Leds_ntv def pixel_count() return self.call_native(8) end + def pixel_offset() + return 0 + end def clear_to(col, bri) self.call_native(9, self.to_gamma(col, bri)) end @@ -155,20 +158,8 @@ class Leds : Leds_ntv # end # apply gamma and bri - def to_gamma(rgbw, bri) - bri = (bri != nil) ? bri : 100 - var r = tasmota.scale_uint(bri, 0, 100, 0, (rgbw & 0xFF0000) >> 16) - var g = tasmota.scale_uint(bri, 0, 100, 0, (rgbw & 0x00FF00) >> 8) - var b = tasmota.scale_uint(bri, 0, 100, 0, (rgbw & 0x0000FF)) - if self.gamma - return light.gamma8(r) << 16 | - light.gamma8(g) << 8 | - light.gamma8(b) - else - return r << 16 | - g << 8 | - b - end + def to_gamma(rgb, bri) + return self.apply_bri_gamma(rgb, bri, self.gamma) end # `segment` @@ -218,15 +209,19 @@ class Leds : Leds_ntv def pixel_size() return self.strip.pixel_size() end + def pixel_offset() + return self.offset + end def pixel_count() return self.leds end def clear_to(col, bri) - var i = 0 - while i < self.leds - self.strip.set_pixel_color(i + self.offset, col, bri) - i += 1 - end + self.strip.call_native(9, self.strip.to_gamma(col, bri), self.offset, self.leds) + # var i = 0 + # while i < self.leds + # self.strip.set_pixel_color(i + self.offset, col, bri) + # i += 1 + # end end def set_pixel_color(idx, col, bri) self.strip.set_pixel_color(idx + self.offset, col, bri) @@ -302,12 +297,11 @@ class Leds : Leds_ntv def pixel_count() return self.w * self.h end + def pixel_offset() + return self.offset + end def clear_to(col, bri) - var i = 0 - while i < self.w * self.h - self.strip.set_pixel_color(i + self.offset, col, bri) - i += 1 - end + self.strip.call_native(9, self.strip.to_gamma(col, bri), self.offset, self.w * self.h) end def set_pixel_color(idx, col, bri) self.strip.set_pixel_color(idx + self.offset, col, bri) diff --git a/lib/libesp32/berry_tasmota/src/embedded/leds_animate_effects.be b/lib/libesp32/berry_tasmota/src/embedded/leds_animate_effects.be new file mode 100644 index 000000000..fd8d112ed --- /dev/null +++ b/lib/libesp32/berry_tasmota/src/embedded/leds_animate_effects.be @@ -0,0 +1,162 @@ +# class Leds_pulse + +#@ solidify:Leds_pulse,weak + +########################################################################################## +# +# class Leds_pulse +# +# Display a color pulse +# +# index (1) +# | +# v +# _______ +# / \ +# _______/ \____________ +# | | | | +# |2| 3 |2| +# +# 1: `index`, start of the pulse (in pixel) +# 2: `slew_size`, number of pixels to fade from back to fore color, can be `0` +# 3: `pulse_size`, number of pixels of the pulse +# +########################################################################################## + +class Leds_pulse + var color + var back_color + var index + var slew_size + var pulse_size + + def init(color, pulse_size, slew_size) + if (color == nil) color = 0xFFFFFF end # white by default + if (pulse_size == nil) pulse_size = 1 end + if (slew_size == nil) slew_size = 0 end + + self.color = color + self.back_color = 0xFF000000 # default to transparent + if pulse_size < 0 pulse_size = 0 end + self.pulse_size = pulse_size + if slew_size < 0 slew_size = 0 end + self.slew_size = slew_size + end + + ## + ## Setters - to be used as cb for animators + ## + def set_color(color) + self.color = color + end + + def set_back_color(c) + self.back_color = c + end + + def set_index(index) + self.index = index + end + + def set_slew_size(slew_size) + self.slew_size = slew_size + end + + def set_pulse_size(pulse_size) + self.pulse_size = pulse_size + end + + # return true if buffer was filled successfully + def paint(frame) + var back_color = self.back_color + if (back_color != 0xFF000000) + frame.fill_pixels(back_color) # fill with transparent color + end + var index = self.index + var slew_size = self.slew_size + var pulse_size = self.pulse_size + var color = self.color + var pixel_size = frame.pixel_size + + # var min_index = index - slew_size + # var max_index = index + pulse_size + slew_size - 1 + + var pulse_min, pulse_max + pulse_min = index + pulse_max = index + pulse_size + if (pulse_min < 0) pulse_min = 0 end + if (pulse_max >= pixel_size) pulse_max = pixel_size end + + var i = pulse_min + while (i < pulse_max) + frame[i] = color + i += 1 + end + + if (slew_size > 0) + # check first slew, from `min_index` to `index - 1` + # Slew 1 + pulse_min = index - slew_size + pulse_max = index + if (pulse_min < 0) pulse_min = 0 end + if (pulse_max >= pixel_size) pulse_max = pixel_size end + i = pulse_min + while (i < pulse_max) + # blend from 255 (back) to 0 (fore) + frame[i] = frame.blend(back_color, color, tasmota.scale_int(i, index - slew_size - 1, index, 255, 0)) + # blend + i += 1 + end + # Slew 2 + pulse_min = index + pulse_size + pulse_max = index + pulse_size + slew_size + if (pulse_min < 0) pulse_min = 0 end + if (pulse_max >= pixel_size) pulse_max = pixel_size end + i = pulse_min + while (i < pulse_max) + # blend + frame[i] = frame.blend(back_color, color, tasmota.scale_int(i, index + pulse_size - 1, index + pulse_size + slew_size, 0, 255)) + i += 1 + end + end + + return true + end + +end + +# +# Unit tests +# +if false + +var frame = Leds_frame(10) +assert(frame.tohex() == '00000000000000000000000000000000000000000000000000000000000000000000000000000000') + +var pulse = Leds_pulse(0x00FF00, 3, 2) +pulse.set_index(5) +pulse.paint(frame) +assert(frame.tohex() == '0000000000000000000000000055000000AA000000FF000000FF000000FF000000AA000000550000') + +pulse.set_back_color(0x111111) +pulse.set_slew_size(1) +pulse.paint(frame) +assert(frame.tohex() == '111111001111110011111100111111000988090000FF000000FF000000FF00000988090011111100') + +pulse.set_back_color(0x00000000) +pulse.paint(frame) +assert(frame.tohex() == '00000000000000000000000000000000007F000000FF000000FF000000FF0000007F000000000000') + +pulse.set_pulse_size(0) +pulse.paint(frame) +assert(frame.tohex() == '00000000000000000000000000000000007F0000007F000000000000000000000000000000000000') + +pulse.set_slew_size(3) +pulse.paint(frame) +assert(frame.tohex() == '000000000000000000400000007F000000BF000000BF0000007F0000004000000000000000000000') + +pulse.set_slew_size(0) +pulse.paint(frame) +assert(frame.tohex() == '00000000000000000000000000000000000000000000000000000000000000000000000000000000') + +end diff --git a/lib/libesp32/berry_tasmota/src/embedded/leds_animator.be b/lib/libesp32/berry_tasmota/src/embedded/leds_animator.be index a6f4fb337..e6de57d09 100644 --- a/lib/libesp32/berry_tasmota/src/embedded/leds_animator.be +++ b/lib/libesp32/berry_tasmota/src/embedded/leds_animator.be @@ -1,29 +1,72 @@ # class Leds_animator #@ solidify:Leds_animator,weak + +# for solidification +class Leds_frame end + +########################################################################################## +# +# class Leds_animator +# +# Simple framework to orchestrate all the animations for a led strip or led matrix +# +# You should pass a Leds or Leds_segment to push pixels at each tick +# This version uses `fast_loop` for up to 5ms animation time (200 Hz) +# +########################################################################################## class Leds_animator var strip # neopixelbus object var pixel_count # number of pixels in the strip var bri # brightness of the animation, 0..100, default 50 var running # is the animation running var animators # animators list + var painters # list of objects that paint layers on top of background (with transparency) + var fast_loop_cb # closure used for fast_loop + static var FAST_LOOP_MIN = 20 + var fast_loop_next # next time-stamp for fast_loop + # cb for animation + var animate_object # object called at each tick + var animate_method # method of object called at each tick + # frame ojects + var frame # Leds_frame frame object + var layer # Leds_frame for layer on top of frame + # background color management (only for uniform background) + var back_color # background color RRGGBB - def init(strip) + def init(strip, bri) self.strip = strip - self.bri = 50 # percentage of brightness 0..100 + if (bri == nil) bri = 50 end + self.bri = bri # percentage of brightness 0..100 self.running = false self.pixel_count = strip.pixel_count() self.animators = [] + self.painters = [] # self.clear() # clear all leds first + self.frame = Leds_frame(self.pixel_count) + self.layer = Leds_frame(self.pixel_count) # - tasmota.add_fast_loop(/-> self.fast_loop()) - # it may be useful to reduce Sleep time here + self.fast_loop_cb = def() self.fast_loop() end + self.back_color = 0x000000 end - def add_anim(anim) + # cb + def set_back_color(col) + self.back_color = col + end + + def add_background_animator(anim) + anim.set_cb(self, self.set_back_color) + self.add_animator(anim) + end + + def add_animator(anim) self.animators.push(anim) - anim.run() # start the animator + end + + def add_painter(painter) + self.painters.push(painter) end def clear() @@ -32,9 +75,25 @@ class Leds_animator end def start() self.running = true + var animators = self.animators + var idx = 0 + while idx < size(animators) + animators[idx].start() + idx += 1 + end + self.fast_loop_next = 0 # run immediately + tasmota.add_fast_loop(self.fast_loop_cb) end + def stop() self.running = false + var animators = self.animators + var idx = 0 + while idx < size(animators) + animators[idx].stop() + idx += 1 + end + tasmota.remove_fast_loop(self.fast_loop_cb) end def set_bri(bri) @@ -44,21 +103,52 @@ class Leds_animator return self.bri end + def set_cb(obj, method) + self.animate_object = obj + self.animate_method = method + end + def fast_loop() - if self.running + if self.running && tasmota.time_reached(self.fast_loop_next) && self.strip.can_show() + # prepare environnement + self.frame.fill_pixels(self.back_color) # run animators first var i = 0 + var now = tasmota.millis() + self.fast_loop_next = now + self.FAST_LOOP_MIN while i < size(self.animators) - var anim = self.animators[i] - if anim.is_running() - anim.animate() - i += 1 - else - self.animators.remove(i) # remove any finished animator + self.animators[i].animate(now) + i += 1 + # var anim = self.animators[i] + # if anim.is_running() + # anim.animate(now) + # i += 1 + # else + # self.animators.remove(i) # remove any finished animator + # end + end + # apply painters + i = 0 + var frame = self.frame + var layer = self.layer + while i < size(self.painters) + layer.fill_pixels(0xFF000000) # fill with transparent color + if (self.painters[i].paint(layer)) + frame.blend_pixels(layer) end + i += 1 end # tirgger animate and display + var obj = self.animate_object + var mth = self.animate_method + if (obj && mth) + mth(obj) + end self.animate() + # now display the frame + self.frame.paste_pixels(self.strip.pixels_buffer(), self.bri, self.strip.gamma) + self.strip.dirty() + self.strip.show() end end @@ -67,6 +157,7 @@ class Leds_animator end def remove() - tasmota.remove_driver(self) + self.clear() + tasmota.remove_fast_loop(self.fast_loop_cb) end end diff --git a/lib/libesp32/berry_tasmota/src/embedded/leds_frame_be_methods.be b/lib/libesp32/berry_tasmota/src/embedded/leds_frame_be_methods.be new file mode 100644 index 000000000..667ead151 --- /dev/null +++ b/lib/libesp32/berry_tasmota/src/embedded/leds_frame_be_methods.be @@ -0,0 +1,28 @@ +#- Native code used for code solidification -# +#- Do not use it -# + +tasmota = nil +#@ solidify:Leds_frame_be +class Leds_frame_be + + def init(pixels) + if (pixels < 0) pixels = -pixels end + self.pixel_size = pixels + super(self).init(pixels * (-4)) + end + + def item(i) + return self.get(i * 4, 4) + end + + def setitem(i, v) + self.set(i * 4, v, 4) + end + + def set_pixel(i, r, g, b, alpha) + if (alpha == nil) alpha = 0 end + var color = ((alpha & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | (b & 0xFF) + self.setitem(i, color) + end + +end diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_module.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_module.h index 7beb1387f..5d0f45c10 100644 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_module.h +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_module.h @@ -4,6 +4,901 @@ \********************************************************************/ #include "be_constobj.h" +extern const bclass be_class_Animate_palette; + +/******************************************************************** +** Solidified function: to_css_gradient +********************************************************************/ +be_local_closure(Animate_palette_to_css_gradient, /* name */ + be_nested_proto( + 15, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str_weak(parse_palette), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str_weak(background_X3Alinear_X2Dgradient_X28to_X20right), + /* K3 */ be_nested_str_weak(palette), + /* K4 */ be_nested_str_weak(get), + /* K5 */ be_nested_str_weak(_X2C_X23_X2502X_X2502X_X2502X_X20_X25_X2E1f_X25_X25), + /* K6 */ be_const_real_hex(0x41200000), + /* K7 */ be_const_int(1), + /* K8 */ be_nested_str_weak(_X29_X3B), + }), + be_str_weak(to_css_gradient), + &be_const_str_solidified, + ( &(const binstruction[42]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x580C0001, // 0001 LDCONST R3 K1 + 0x541203E7, // 0002 LDINT R4 1000 + 0x7C040600, // 0003 CALL R1 3 + 0x58080002, // 0004 LDCONST R2 K2 + 0x580C0001, // 0005 LDCONST R3 K1 + 0x6010000C, // 0006 GETGBL R4 G12 + 0x5C140200, // 0007 MOVE R5 R1 + 0x7C100200, // 0008 CALL R4 1 + 0x14100604, // 0009 LT R4 R3 R4 + 0x7812001C, // 000A JMPF R4 #0028 + 0x94100203, // 000B GETIDX R4 R1 R3 + 0x88140103, // 000C GETMBR R5 R0 K3 + 0x8C140B04, // 000D GETMET R5 R5 K4 + 0x541E0003, // 000E LDINT R7 4 + 0x081C0607, // 000F MUL R7 R3 R7 + 0x54220003, // 0010 LDINT R8 4 + 0x7C140600, // 0011 CALL R5 3 + 0x541A0007, // 0012 LDINT R6 8 + 0x3C180A06, // 0013 SHR R6 R5 R6 + 0x541E00FE, // 0014 LDINT R7 255 + 0x2C180C07, // 0015 AND R6 R6 R7 + 0x541E000F, // 0016 LDINT R7 16 + 0x3C1C0A07, // 0017 SHR R7 R5 R7 + 0x542200FE, // 0018 LDINT R8 255 + 0x2C1C0E08, // 0019 AND R7 R7 R8 + 0x54220017, // 001A LDINT R8 24 + 0x3C200A08, // 001B SHR R8 R5 R8 + 0x542600FE, // 001C LDINT R9 255 + 0x2C201009, // 001D AND R8 R8 R9 + 0x60240018, // 001E GETGBL R9 G24 + 0x58280005, // 001F LDCONST R10 K5 + 0x5C2C0C00, // 0020 MOVE R11 R6 + 0x5C300E00, // 0021 MOVE R12 R7 + 0x5C341000, // 0022 MOVE R13 R8 + 0x0C380906, // 0023 DIV R14 R4 K6 + 0x7C240A00, // 0024 CALL R9 5 + 0x00080409, // 0025 ADD R2 R2 R9 + 0x000C0707, // 0026 ADD R3 R3 K7 + 0x7001FFDD, // 0027 JMP #0006 + 0x00080508, // 0028 ADD R2 R2 K8 + 0x80040400, // 0029 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: parse_palette +********************************************************************/ +be_local_closure(Animate_palette_parse_palette, /* name */ + be_nested_proto( + 15, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str_weak(slots), + /* K1 */ be_nested_str_weak(resize), + /* K2 */ be_nested_str_weak(palette), + /* K3 */ be_nested_str_weak(get), + /* K4 */ be_const_int(0), + /* K5 */ be_const_int(1), + /* K6 */ be_nested_str_weak(tasmota), + /* K7 */ be_nested_str_weak(scale_int), + }), + be_str_weak(parse_palette), + &be_const_str_solidified, + ( &(const binstruction[71]) { /* code */ + 0x600C0012, // 0000 GETGBL R3 G18 + 0x7C0C0000, // 0001 CALL R3 0 + 0x88100100, // 0002 GETMBR R4 R0 K0 + 0x8C140701, // 0003 GETMET R5 R3 K1 + 0x5C1C0800, // 0004 MOVE R7 R4 + 0x7C140400, // 0005 CALL R5 2 + 0x88140102, // 0006 GETMBR R5 R0 K2 + 0x8C140B03, // 0007 GETMET R5 R5 K3 + 0x581C0004, // 0008 LDCONST R7 K4 + 0x58200005, // 0009 LDCONST R8 K5 + 0x7C140600, // 000A CALL R5 3 + 0x20140B04, // 000B NE R5 R5 K4 + 0x78160024, // 000C JMPF R5 #0032 + 0x58140004, // 000D LDCONST R5 K4 + 0x58180004, // 000E LDCONST R6 K4 + 0x041C0905, // 000F SUB R7 R4 K5 + 0x141C0C07, // 0010 LT R7 R6 R7 + 0x781E0008, // 0011 JMPF R7 #001B + 0x881C0102, // 0012 GETMBR R7 R0 K2 + 0x8C1C0F03, // 0013 GETMET R7 R7 K3 + 0x54260003, // 0014 LDINT R9 4 + 0x08240C09, // 0015 MUL R9 R6 R9 + 0x58280005, // 0016 LDCONST R10 K5 + 0x7C1C0600, // 0017 CALL R7 3 + 0x00140A07, // 0018 ADD R5 R5 R7 + 0x00180D05, // 0019 ADD R6 R6 K5 + 0x7001FFF3, // 001A JMP #000F + 0x581C0004, // 001B LDCONST R7 K4 + 0x58180004, // 001C LDCONST R6 K4 + 0x14200C04, // 001D LT R8 R6 R4 + 0x78220011, // 001E JMPF R8 #0031 + 0xB8220C00, // 001F GETNGBL R8 K6 + 0x8C201107, // 0020 GETMET R8 R8 K7 + 0x5C280E00, // 0021 MOVE R10 R7 + 0x582C0004, // 0022 LDCONST R11 K4 + 0x5C300A00, // 0023 MOVE R12 R5 + 0x5C340200, // 0024 MOVE R13 R1 + 0x5C380400, // 0025 MOVE R14 R2 + 0x7C200C00, // 0026 CALL R8 6 + 0x980C0C08, // 0027 SETIDX R3 R6 R8 + 0x88200102, // 0028 GETMBR R8 R0 K2 + 0x8C201103, // 0029 GETMET R8 R8 K3 + 0x542A0003, // 002A LDINT R10 4 + 0x08280C0A, // 002B MUL R10 R6 R10 + 0x582C0005, // 002C LDCONST R11 K5 + 0x7C200600, // 002D CALL R8 3 + 0x001C0E08, // 002E ADD R7 R7 R8 + 0x00180D05, // 002F ADD R6 R6 K5 + 0x7001FFEB, // 0030 JMP #001D + 0x70020013, // 0031 JMP #0046 + 0x58140004, // 0032 LDCONST R5 K4 + 0x14180A04, // 0033 LT R6 R5 R4 + 0x781A0010, // 0034 JMPF R6 #0046 + 0x88180102, // 0035 GETMBR R6 R0 K2 + 0x8C180D03, // 0036 GETMET R6 R6 K3 + 0x54220003, // 0037 LDINT R8 4 + 0x08200A08, // 0038 MUL R8 R5 R8 + 0x58240005, // 0039 LDCONST R9 K5 + 0x7C180600, // 003A CALL R6 3 + 0xB81E0C00, // 003B GETNGBL R7 K6 + 0x8C1C0F07, // 003C GETMET R7 R7 K7 + 0x5C240C00, // 003D MOVE R9 R6 + 0x58280004, // 003E LDCONST R10 K4 + 0x542E00FE, // 003F LDINT R11 255 + 0x5C300200, // 0040 MOVE R12 R1 + 0x5C340400, // 0041 MOVE R13 R2 + 0x7C1C0C00, // 0042 CALL R7 6 + 0x980C0A07, // 0043 SETIDX R3 R5 R7 + 0x00140B05, // 0044 ADD R5 R5 K5 + 0x7001FFEC, // 0045 JMP #0033 + 0x80040600, // 0046 RET 1 R3 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Animate_palette_init, /* name */ + be_nested_proto( + 7, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str_weak(running), + /* K1 */ be_nested_str_weak(palette), + /* K2 */ be_nested_str_weak(bri), + /* K3 */ be_nested_str_weak(slots), + /* K4 */ be_nested_str_weak(set_duration), + /* K5 */ be_nested_str_weak(color), + /* K6 */ be_nested_str_weak(light_state), + /* K7 */ be_nested_str_weak(RGB), + }), + be_str_weak(init), + &be_const_str_solidified, + ( &(const binstruction[26]) { /* code */ + 0x500C0000, // 0000 LDBOOL R3 0 0 + 0x90020003, // 0001 SETMBR R0 K0 R3 + 0x90020201, // 0002 SETMBR R0 K1 R1 + 0x540E0063, // 0003 LDINT R3 100 + 0x90020403, // 0004 SETMBR R0 K2 R3 + 0x600C000C, // 0005 GETGBL R3 G12 + 0x5C100200, // 0006 MOVE R4 R1 + 0x7C0C0200, // 0007 CALL R3 1 + 0x54120003, // 0008 LDINT R4 4 + 0x0C0C0604, // 0009 DIV R3 R3 R4 + 0x90020603, // 000A SETMBR R0 K3 R3 + 0x4C0C0000, // 000B LDNIL R3 + 0x200C0403, // 000C NE R3 R2 R3 + 0x780E0005, // 000D JMPF R3 #0014 + 0x8C0C0104, // 000E GETMET R3 R0 K4 + 0x60140009, // 000F GETGBL R5 G9 + 0x541A03E7, // 0010 LDINT R6 1000 + 0x08180406, // 0011 MUL R6 R2 R6 + 0x7C140200, // 0012 CALL R5 1 + 0x7C0C0400, // 0013 CALL R3 2 + 0xB80E0C00, // 0014 GETNGBL R3 K6 + 0xB8120C00, // 0015 GETNGBL R4 K6 + 0x88100907, // 0016 GETMBR R4 R4 K7 + 0x7C0C0200, // 0017 CALL R3 1 + 0x90020A03, // 0018 SETMBR R0 K5 R3 + 0x80000000, // 0019 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_cb +********************************************************************/ +be_local_closure(Animate_palette_set_cb, /* name */ + be_nested_proto( + 3, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(animate_obj), + /* K1 */ be_nested_str_weak(animate_mth), + }), + be_str_weak(set_cb), + &be_const_str_solidified, + ( &(const binstruction[ 3]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x90020202, // 0001 SETMBR R0 K1 R2 + 0x80000000, // 0002 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: stop +********************************************************************/ +be_local_closure(Animate_palette_stop, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(origin), + /* K1 */ be_nested_str_weak(running), + }), + be_str_weak(stop), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x4C040000, // 0000 LDNIL R1 + 0x90020001, // 0001 SETMBR R0 K0 R1 + 0x50040000, // 0002 LDBOOL R1 0 0 + 0x90020201, // 0003 SETMBR R0 K1 R1 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: animate +********************************************************************/ +be_local_closure(Animate_palette_animate, /* name */ + be_nested_proto( + 26, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[21]) { /* constants */ + /* K0 */ be_nested_str_weak(duration_ms), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(millis), + /* K3 */ be_nested_str_weak(origin), + /* K4 */ be_const_int(0), + /* K5 */ be_nested_str_weak(scale_uint), + /* K6 */ be_nested_str_weak(slots), + /* K7 */ be_const_int(2), + /* K8 */ be_nested_str_weak(slots_arr), + /* K9 */ be_const_int(1), + /* K10 */ be_nested_str_weak(palette), + /* K11 */ be_nested_str_weak(get), + /* K12 */ be_nested_str_weak(color), + /* K13 */ be_nested_str_weak(set_rgb), + /* K14 */ be_nested_str_weak(bri), + /* K15 */ be_nested_str_weak(set_bri), + /* K16 */ be_nested_str_weak(r), + /* K17 */ be_nested_str_weak(g), + /* K18 */ be_nested_str_weak(b), + /* K19 */ be_nested_str_weak(animate_obj), + /* K20 */ be_nested_str_weak(animate_mth), + }), + be_str_weak(animate), + &be_const_str_solidified, + ( &(const binstruction[193]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x4C0C0000, // 0001 LDNIL R3 + 0x1C080403, // 0002 EQ R2 R2 R3 + 0x780A0000, // 0003 JMPF R2 #0005 + 0x80000400, // 0004 RET 0 + 0x4C080000, // 0005 LDNIL R2 + 0x1C080202, // 0006 EQ R2 R1 R2 + 0x780A0003, // 0007 JMPF R2 #000C + 0xB80A0200, // 0008 GETNGBL R2 K1 + 0x8C080502, // 0009 GETMET R2 R2 K2 + 0x7C080200, // 000A CALL R2 1 + 0x5C040400, // 000B MOVE R1 R2 + 0x88080103, // 000C GETMBR R2 R0 K3 + 0x04080202, // 000D SUB R2 R1 R2 + 0x140C0504, // 000E LT R3 R2 K4 + 0x780E0001, // 000F JMPF R3 #0012 + 0x58080004, // 0010 LDCONST R2 K4 + 0x88040103, // 0011 GETMBR R1 R0 K3 + 0x880C0100, // 0012 GETMBR R3 R0 K0 + 0xB8120200, // 0013 GETNGBL R4 K1 + 0x88100905, // 0014 GETMBR R4 R4 K5 + 0x28140403, // 0015 GE R5 R2 R3 + 0x78160005, // 0016 JMPF R5 #001D + 0x0C180403, // 0017 DIV R6 R2 R3 + 0x08180C03, // 0018 MUL R6 R6 R3 + 0x88140103, // 0019 GETMBR R5 R0 K3 + 0x00140A06, // 001A ADD R5 R5 R6 + 0x90020605, // 001B SETMBR R0 K3 R5 + 0x10080403, // 001C MOD R2 R2 R3 + 0x88140106, // 001D GETMBR R5 R0 K6 + 0x04180B07, // 001E SUB R6 R5 K7 + 0x241C0D04, // 001F GT R7 R6 K4 + 0x781E0006, // 0020 JMPF R7 #0028 + 0x881C0108, // 0021 GETMBR R7 R0 K8 + 0x941C0E06, // 0022 GETIDX R7 R7 R6 + 0x281C0407, // 0023 GE R7 R2 R7 + 0x781E0000, // 0024 JMPF R7 #0026 + 0x70020001, // 0025 JMP #0028 + 0x04180D09, // 0026 SUB R6 R6 K9 + 0x7001FFF6, // 0027 JMP #001F + 0x881C010A, // 0028 GETMBR R7 R0 K10 + 0x8C1C0F0B, // 0029 GETMET R7 R7 K11 + 0x54260003, // 002A LDINT R9 4 + 0x08240C09, // 002B MUL R9 R6 R9 + 0x542A0003, // 002C LDINT R10 4 + 0x7C1C0600, // 002D CALL R7 3 + 0x8820010A, // 002E GETMBR R8 R0 K10 + 0x8C20110B, // 002F GETMET R8 R8 K11 + 0x00280D09, // 0030 ADD R10 R6 K9 + 0x542E0003, // 0031 LDINT R11 4 + 0x0828140B, // 0032 MUL R10 R10 R11 + 0x542E0003, // 0033 LDINT R11 4 + 0x7C200600, // 0034 CALL R8 3 + 0x88240108, // 0035 GETMBR R9 R0 K8 + 0x94241206, // 0036 GETIDX R9 R9 R6 + 0x00280D09, // 0037 ADD R10 R6 K9 + 0x882C0108, // 0038 GETMBR R11 R0 K8 + 0x9428160A, // 0039 GETIDX R10 R11 R10 + 0x5C300800, // 003A MOVE R12 R4 + 0x5C340400, // 003B MOVE R13 R2 + 0x5C381200, // 003C MOVE R14 R9 + 0x5C3C1400, // 003D MOVE R15 R10 + 0x54420007, // 003E LDINT R16 8 + 0x3C400E10, // 003F SHR R16 R7 R16 + 0x544600FE, // 0040 LDINT R17 255 + 0x2C402011, // 0041 AND R16 R16 R17 + 0x54460007, // 0042 LDINT R17 8 + 0x3C441011, // 0043 SHR R17 R8 R17 + 0x544A00FE, // 0044 LDINT R18 255 + 0x2C442212, // 0045 AND R17 R17 R18 + 0x7C300A00, // 0046 CALL R12 5 + 0x5C2C1800, // 0047 MOVE R11 R12 + 0x5C300800, // 0048 MOVE R12 R4 + 0x5C340400, // 0049 MOVE R13 R2 + 0x5C381200, // 004A MOVE R14 R9 + 0x5C3C1400, // 004B MOVE R15 R10 + 0x5442000F, // 004C LDINT R16 16 + 0x3C400E10, // 004D SHR R16 R7 R16 + 0x544600FE, // 004E LDINT R17 255 + 0x2C402011, // 004F AND R16 R16 R17 + 0x5446000F, // 0050 LDINT R17 16 + 0x3C441011, // 0051 SHR R17 R8 R17 + 0x544A00FE, // 0052 LDINT R18 255 + 0x2C442212, // 0053 AND R17 R17 R18 + 0x7C300A00, // 0054 CALL R12 5 + 0x5C340800, // 0055 MOVE R13 R4 + 0x5C380400, // 0056 MOVE R14 R2 + 0x5C3C1200, // 0057 MOVE R15 R9 + 0x5C401400, // 0058 MOVE R16 R10 + 0x54460017, // 0059 LDINT R17 24 + 0x3C440E11, // 005A SHR R17 R7 R17 + 0x544A00FE, // 005B LDINT R18 255 + 0x2C442212, // 005C AND R17 R17 R18 + 0x544A0017, // 005D LDINT R18 24 + 0x3C481012, // 005E SHR R18 R8 R18 + 0x544E00FE, // 005F LDINT R19 255 + 0x2C482413, // 0060 AND R18 R18 R19 + 0x7C340A00, // 0061 CALL R13 5 + 0x8838010C, // 0062 GETMBR R14 R0 K12 + 0x8C3C1D0D, // 0063 GETMET R15 R14 K13 + 0x54460007, // 0064 LDINT R17 8 + 0x3C440E11, // 0065 SHR R17 R7 R17 + 0x544A00FE, // 0066 LDINT R18 255 + 0x2C442212, // 0067 AND R17 R17 R18 + 0x544A000F, // 0068 LDINT R18 16 + 0x3C480E12, // 0069 SHR R18 R7 R18 + 0x544E00FE, // 006A LDINT R19 255 + 0x2C482413, // 006B AND R18 R18 R19 + 0x544E0017, // 006C LDINT R19 24 + 0x3C4C0E13, // 006D SHR R19 R7 R19 + 0x545200FE, // 006E LDINT R20 255 + 0x2C4C2614, // 006F AND R19 R19 R20 + 0x7C3C0800, // 0070 CALL R15 4 + 0x883C1D0E, // 0071 GETMBR R15 R14 K14 + 0x8C401D0D, // 0072 GETMET R16 R14 K13 + 0x544A0007, // 0073 LDINT R18 8 + 0x3C481012, // 0074 SHR R18 R8 R18 + 0x544E00FE, // 0075 LDINT R19 255 + 0x2C482413, // 0076 AND R18 R18 R19 + 0x544E000F, // 0077 LDINT R19 16 + 0x3C4C1013, // 0078 SHR R19 R8 R19 + 0x545200FE, // 0079 LDINT R20 255 + 0x2C4C2614, // 007A AND R19 R19 R20 + 0x54520017, // 007B LDINT R20 24 + 0x3C501014, // 007C SHR R20 R8 R20 + 0x545600FE, // 007D LDINT R21 255 + 0x2C502815, // 007E AND R20 R20 R21 + 0x7C400800, // 007F CALL R16 4 + 0x88401D0E, // 0080 GETMBR R16 R14 K14 + 0x5C440800, // 0081 MOVE R17 R4 + 0x5C480400, // 0082 MOVE R18 R2 + 0x5C4C1200, // 0083 MOVE R19 R9 + 0x5C501400, // 0084 MOVE R20 R10 + 0x5C541E00, // 0085 MOVE R21 R15 + 0x5C582000, // 0086 MOVE R22 R16 + 0x7C440A00, // 0087 CALL R17 5 + 0x8C481D0D, // 0088 GETMET R18 R14 K13 + 0x5C501600, // 0089 MOVE R20 R11 + 0x5C541800, // 008A MOVE R21 R12 + 0x5C581A00, // 008B MOVE R22 R13 + 0x7C480800, // 008C CALL R18 4 + 0x8C481D0F, // 008D GETMET R18 R14 K15 + 0x5C502200, // 008E MOVE R20 R17 + 0x7C480400, // 008F CALL R18 2 + 0x882C1D10, // 0090 GETMBR R11 R14 K16 + 0x88301D11, // 0091 GETMBR R12 R14 K17 + 0x88341D12, // 0092 GETMBR R13 R14 K18 + 0x8848010E, // 0093 GETMBR R18 R0 K14 + 0x544E0063, // 0094 LDINT R19 100 + 0x204C2413, // 0095 NE R19 R18 R19 + 0x784E001A, // 0096 JMPF R19 #00B2 + 0xB84E0200, // 0097 GETNGBL R19 K1 + 0x8C4C2705, // 0098 GETMET R19 R19 K5 + 0x5C541600, // 0099 MOVE R21 R11 + 0x58580004, // 009A LDCONST R22 K4 + 0x545E0063, // 009B LDINT R23 100 + 0x58600004, // 009C LDCONST R24 K4 + 0x5C642400, // 009D MOVE R25 R18 + 0x7C4C0C00, // 009E CALL R19 6 + 0x5C2C2600, // 009F MOVE R11 R19 + 0xB84E0200, // 00A0 GETNGBL R19 K1 + 0x8C4C2705, // 00A1 GETMET R19 R19 K5 + 0x5C541800, // 00A2 MOVE R21 R12 + 0x58580004, // 00A3 LDCONST R22 K4 + 0x545E0063, // 00A4 LDINT R23 100 + 0x58600004, // 00A5 LDCONST R24 K4 + 0x5C642400, // 00A6 MOVE R25 R18 + 0x7C4C0C00, // 00A7 CALL R19 6 + 0x5C302600, // 00A8 MOVE R12 R19 + 0xB84E0200, // 00A9 GETNGBL R19 K1 + 0x8C4C2705, // 00AA GETMET R19 R19 K5 + 0x5C541A00, // 00AB MOVE R21 R13 + 0x58580004, // 00AC LDCONST R22 K4 + 0x545E0063, // 00AD LDINT R23 100 + 0x58600004, // 00AE LDCONST R24 K4 + 0x5C642400, // 00AF MOVE R25 R18 + 0x7C4C0C00, // 00B0 CALL R19 6 + 0x5C342600, // 00B1 MOVE R13 R19 + 0x544E000F, // 00B2 LDINT R19 16 + 0x384C1613, // 00B3 SHL R19 R11 R19 + 0x54520007, // 00B4 LDINT R20 8 + 0x38501814, // 00B5 SHL R20 R12 R20 + 0x304C2614, // 00B6 OR R19 R19 R20 + 0x304C260D, // 00B7 OR R19 R19 R13 + 0x88500113, // 00B8 GETMBR R20 R0 K19 + 0x88540114, // 00B9 GETMBR R21 R0 K20 + 0x78520004, // 00BA JMPF R20 #00C0 + 0x78560003, // 00BB JMPF R21 #00C0 + 0x5C582A00, // 00BC MOVE R22 R21 + 0x5C5C2800, // 00BD MOVE R23 R20 + 0x5C602600, // 00BE MOVE R24 R19 + 0x7C580400, // 00BF CALL R22 2 + 0x80042600, // 00C0 RET 1 R19 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_range +********************************************************************/ +be_local_closure(Animate_palette_set_range, /* name */ + be_nested_proto( + 7, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str_weak(value_error), + /* K1 */ be_nested_str_weak(min_X20must_X20be_X20lower_X20than_X20mex), + /* K2 */ be_nested_str_weak(range_min), + /* K3 */ be_nested_str_weak(range_max), + /* K4 */ be_nested_str_weak(slots_arr), + /* K5 */ be_nested_str_weak(parse_palette), + }), + be_str_weak(set_range), + &be_const_str_solidified, + ( &(const binstruction[11]) { /* code */ + 0x280C0202, // 0000 GE R3 R1 R2 + 0x780E0000, // 0001 JMPF R3 #0003 + 0xB0060101, // 0002 RAISE 1 K0 K1 + 0x90020401, // 0003 SETMBR R0 K2 R1 + 0x90020602, // 0004 SETMBR R0 K3 R2 + 0x8C0C0105, // 0005 GETMET R3 R0 K5 + 0x5C140200, // 0006 MOVE R5 R1 + 0x5C180400, // 0007 MOVE R6 R2 + 0x7C0C0600, // 0008 CALL R3 3 + 0x90020803, // 0009 SETMBR R0 K4 R3 + 0x80000000, // 000A RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_bri +********************************************************************/ +be_local_closure(Animate_palette_set_bri, /* name */ + be_nested_proto( + 4, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(bri), + }), + be_str_weak(set_bri), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x60080009, // 0000 GETGBL R2 G9 + 0x5C0C0200, // 0001 MOVE R3 R1 + 0x7C080200, // 0002 CALL R2 1 + 0x90020002, // 0003 SETMBR R0 K0 R2 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: is_running +********************************************************************/ +be_local_closure(Animate_palette_is_running, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(running), + }), + be_str_weak(is_running), + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x60040017, // 0000 GETGBL R1 G23 + 0x88080100, // 0001 GETMBR R2 R0 K0 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_duration +********************************************************************/ +be_local_closure(Animate_palette_set_duration, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_nested_str_weak(value_error), + /* K2 */ be_nested_str_weak(duration_ms_X20must_X20be_X20positive), + /* K3 */ be_nested_str_weak(duration_ms), + /* K4 */ be_nested_str_weak(slots_arr), + /* K5 */ be_nested_str_weak(parse_palette), + /* K6 */ be_const_int(1), + }), + be_str_weak(set_duration), + &be_const_str_solidified, + ( &(const binstruction[14]) { /* code */ + 0x4C080000, // 0000 LDNIL R2 + 0x1C080202, // 0001 EQ R2 R1 R2 + 0x780A0000, // 0002 JMPF R2 #0004 + 0x80000400, // 0003 RET 0 + 0x18080300, // 0004 LE R2 R1 K0 + 0x780A0000, // 0005 JMPF R2 #0007 + 0xB0060302, // 0006 RAISE 1 K1 K2 + 0x90020601, // 0007 SETMBR R0 K3 R1 + 0x8C080105, // 0008 GETMET R2 R0 K5 + 0x58100000, // 0009 LDCONST R4 K0 + 0x04140306, // 000A SUB R5 R1 K6 + 0x7C080600, // 000B CALL R2 3 + 0x90020802, // 000C SETMBR R0 K4 R2 + 0x80000000, // 000D RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_value +********************************************************************/ +be_local_closure(Animate_palette_set_value, /* name */ + be_nested_proto( + 18, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[13]) { /* constants */ + /* K0 */ be_nested_str_weak(range_min), + /* K1 */ be_nested_str_weak(range_max), + /* K2 */ be_nested_str_weak(tasmota), + /* K3 */ be_nested_str_weak(scale_int), + /* K4 */ be_nested_str_weak(slots), + /* K5 */ be_const_int(2), + /* K6 */ be_const_int(0), + /* K7 */ be_nested_str_weak(slots_arr), + /* K8 */ be_const_int(1), + /* K9 */ be_nested_str_weak(palette), + /* K10 */ be_nested_str_weak(get), + /* K11 */ be_nested_str_weak(animate_obj), + /* K12 */ be_nested_str_weak(animate_mth), + }), + be_str_weak(set_value), + &be_const_str_solidified, + ( &(const binstruction[96]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x4C0C0000, // 0001 LDNIL R3 + 0x1C080403, // 0002 EQ R2 R2 R3 + 0x740A0003, // 0003 JMPT R2 #0008 + 0x88080101, // 0004 GETMBR R2 R0 K1 + 0x4C0C0000, // 0005 LDNIL R3 + 0x1C080403, // 0006 EQ R2 R2 R3 + 0x780A0001, // 0007 JMPF R2 #000A + 0x4C080000, // 0008 LDNIL R2 + 0x80040400, // 0009 RET 1 R2 + 0xB80A0400, // 000A GETNGBL R2 K2 + 0x88080503, // 000B GETMBR R2 R2 K3 + 0x880C0104, // 000C GETMBR R3 R0 K4 + 0x04100705, // 000D SUB R4 R3 K5 + 0x24140906, // 000E GT R5 R4 K6 + 0x78160006, // 000F JMPF R5 #0017 + 0x88140107, // 0010 GETMBR R5 R0 K7 + 0x94140A04, // 0011 GETIDX R5 R5 R4 + 0x28140205, // 0012 GE R5 R1 R5 + 0x78160000, // 0013 JMPF R5 #0015 + 0x70020001, // 0014 JMP #0017 + 0x04100908, // 0015 SUB R4 R4 K8 + 0x7001FFF6, // 0016 JMP #000E + 0x88140109, // 0017 GETMBR R5 R0 K9 + 0x8C140B0A, // 0018 GETMET R5 R5 K10 + 0x541E0003, // 0019 LDINT R7 4 + 0x081C0807, // 001A MUL R7 R4 R7 + 0x54220003, // 001B LDINT R8 4 + 0x7C140600, // 001C CALL R5 3 + 0x88180109, // 001D GETMBR R6 R0 K9 + 0x8C180D0A, // 001E GETMET R6 R6 K10 + 0x00200908, // 001F ADD R8 R4 K8 + 0x54260003, // 0020 LDINT R9 4 + 0x08201009, // 0021 MUL R8 R8 R9 + 0x54260003, // 0022 LDINT R9 4 + 0x7C180600, // 0023 CALL R6 3 + 0x881C0107, // 0024 GETMBR R7 R0 K7 + 0x941C0E04, // 0025 GETIDX R7 R7 R4 + 0x00200908, // 0026 ADD R8 R4 K8 + 0x88240107, // 0027 GETMBR R9 R0 K7 + 0x94201208, // 0028 GETIDX R8 R9 R8 + 0x5C280400, // 0029 MOVE R10 R2 + 0x5C2C0200, // 002A MOVE R11 R1 + 0x5C300E00, // 002B MOVE R12 R7 + 0x5C341000, // 002C MOVE R13 R8 + 0x543A0007, // 002D LDINT R14 8 + 0x3C380A0E, // 002E SHR R14 R5 R14 + 0x543E00FE, // 002F LDINT R15 255 + 0x2C381C0F, // 0030 AND R14 R14 R15 + 0x543E0007, // 0031 LDINT R15 8 + 0x3C3C0C0F, // 0032 SHR R15 R6 R15 + 0x544200FE, // 0033 LDINT R16 255 + 0x2C3C1E10, // 0034 AND R15 R15 R16 + 0x7C280A00, // 0035 CALL R10 5 + 0x5C241400, // 0036 MOVE R9 R10 + 0x5C280400, // 0037 MOVE R10 R2 + 0x5C2C0200, // 0038 MOVE R11 R1 + 0x5C300E00, // 0039 MOVE R12 R7 + 0x5C341000, // 003A MOVE R13 R8 + 0x543A000F, // 003B LDINT R14 16 + 0x3C380A0E, // 003C SHR R14 R5 R14 + 0x543E00FE, // 003D LDINT R15 255 + 0x2C381C0F, // 003E AND R14 R14 R15 + 0x543E000F, // 003F LDINT R15 16 + 0x3C3C0C0F, // 0040 SHR R15 R6 R15 + 0x544200FE, // 0041 LDINT R16 255 + 0x2C3C1E10, // 0042 AND R15 R15 R16 + 0x7C280A00, // 0043 CALL R10 5 + 0x5C2C0400, // 0044 MOVE R11 R2 + 0x5C300200, // 0045 MOVE R12 R1 + 0x5C340E00, // 0046 MOVE R13 R7 + 0x5C381000, // 0047 MOVE R14 R8 + 0x543E0017, // 0048 LDINT R15 24 + 0x3C3C0A0F, // 0049 SHR R15 R5 R15 + 0x544200FE, // 004A LDINT R16 255 + 0x2C3C1E10, // 004B AND R15 R15 R16 + 0x54420017, // 004C LDINT R16 24 + 0x3C400C10, // 004D SHR R16 R6 R16 + 0x544600FE, // 004E LDINT R17 255 + 0x2C402011, // 004F AND R16 R16 R17 + 0x7C2C0A00, // 0050 CALL R11 5 + 0x5432000F, // 0051 LDINT R12 16 + 0x3830120C, // 0052 SHL R12 R9 R12 + 0x54360007, // 0053 LDINT R13 8 + 0x3834140D, // 0054 SHL R13 R10 R13 + 0x3030180D, // 0055 OR R12 R12 R13 + 0x3030180B, // 0056 OR R12 R12 R11 + 0x8834010B, // 0057 GETMBR R13 R0 K11 + 0x8838010C, // 0058 GETMBR R14 R0 K12 + 0x78360004, // 0059 JMPF R13 #005F + 0x783A0003, // 005A JMPF R14 #005F + 0x5C3C1C00, // 005B MOVE R15 R14 + 0x5C401A00, // 005C MOVE R16 R13 + 0x5C441800, // 005D MOVE R17 R12 + 0x7C3C0400, // 005E CALL R15 2 + 0x80041800, // 005F RET 1 R12 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: start +********************************************************************/ +be_local_closure(Animate_palette_start, /* name */ + be_nested_proto( + 4, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(duration_ms), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(millis), + /* K3 */ be_nested_str_weak(origin), + /* K4 */ be_nested_str_weak(running), + }), + be_str_weak(start), + &be_const_str_solidified, + ( &(const binstruction[16]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x4C0C0000, // 0001 LDNIL R3 + 0x1C080403, // 0002 EQ R2 R2 R3 + 0x780A0000, // 0003 JMPF R2 #0005 + 0x80000400, // 0004 RET 0 + 0x4C080000, // 0005 LDNIL R2 + 0x1C080202, // 0006 EQ R2 R1 R2 + 0x780A0003, // 0007 JMPF R2 #000C + 0xB80A0200, // 0008 GETNGBL R2 K1 + 0x8C080502, // 0009 GETMET R2 R2 K2 + 0x7C080200, // 000A CALL R2 1 + 0x5C040400, // 000B MOVE R1 R2 + 0x90020601, // 000C SETMBR R0 K3 R1 + 0x50080200, // 000D LDBOOL R2 1 0 + 0x90020802, // 000E SETMBR R0 K4 R2 + 0x80000000, // 000F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Animate_palette +********************************************************************/ +be_local_class(Animate_palette, + 12, + NULL, + be_nested_map(24, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(start, -1), be_const_closure(Animate_palette_start_closure) }, + { be_const_key_weak(to_css_gradient, -1), be_const_closure(Animate_palette_to_css_gradient_closure) }, + { be_const_key_weak(range_min, -1), be_const_var(6) }, + { be_const_key_weak(init, -1), be_const_closure(Animate_palette_init_closure) }, + { be_const_key_weak(set_value, -1), be_const_closure(Animate_palette_set_value_closure) }, + { be_const_key_weak(stop, -1), be_const_closure(Animate_palette_stop_closure) }, + { be_const_key_weak(slots, 15), be_const_var(2) }, + { be_const_key_weak(origin, -1), be_const_var(5) }, + { be_const_key_weak(animate, 19), be_const_closure(Animate_palette_animate_closure) }, + { be_const_key_weak(set_range, 2), be_const_closure(Animate_palette_set_range_closure) }, + { be_const_key_weak(slots_arr, -1), be_const_var(1) }, + { be_const_key_weak(set_bri, -1), be_const_closure(Animate_palette_set_bri_closure) }, + { be_const_key_weak(bri, 17), be_const_var(10) }, + { be_const_key_weak(is_running, -1), be_const_closure(Animate_palette_is_running_closure) }, + { be_const_key_weak(animate_mth, -1), be_const_var(9) }, + { be_const_key_weak(duration_ms, -1), be_const_var(4) }, + { be_const_key_weak(color, -1), be_const_var(11) }, + { be_const_key_weak(set_duration, 22), be_const_closure(Animate_palette_set_duration_closure) }, + { be_const_key_weak(animate_obj, -1), be_const_var(8) }, + { be_const_key_weak(palette, -1), be_const_var(0) }, + { be_const_key_weak(parse_palette, 14), be_const_closure(Animate_palette_parse_palette_closure) }, + { be_const_key_weak(set_cb, 4), be_const_closure(Animate_palette_set_cb_closure) }, + { be_const_key_weak(running, -1), be_const_var(3) }, + { be_const_key_weak(range_max, 0), be_const_var(7) }, + })), + be_str_weak(Animate_palette) +); + extern const bclass be_class_Animate_rotate; /******************************************************************** @@ -11,8 +906,8 @@ extern const bclass be_class_Animate_rotate; ********************************************************************/ be_local_closure(Animate_rotate_init, /* name */ be_nested_proto( - 12, /* nstack */ - 5, /* argc */ + 13, /* nstack */ + 6, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ @@ -20,43 +915,46 @@ be_local_closure(Animate_rotate_init, /* name */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 8]) { /* constants */ - /* K0 */ be_nested_str(init), - /* K1 */ be_nested_str(closure), - /* K2 */ be_nested_str(code), - /* K3 */ be_nested_str(push), - /* K4 */ be_nested_str(animate), - /* K5 */ be_nested_str(ins_ramp), - /* K6 */ be_nested_str(ins_goto), + /* K0 */ be_nested_str_weak(init), + /* K1 */ be_nested_str_weak(set_cb), + /* K2 */ be_nested_str_weak(code), + /* K3 */ be_nested_str_weak(push), + /* K4 */ be_nested_str_weak(animate), + /* K5 */ be_nested_str_weak(ins_ramp), + /* K6 */ be_nested_str_weak(ins_goto), /* K7 */ be_const_int(0), }), - &be_const_str_init, + be_str_weak(init), &be_const_str_solidified, - ( &(const binstruction[25]) { /* code */ - 0x60140003, // 0000 GETGBL R5 G3 - 0x5C180000, // 0001 MOVE R6 R0 - 0x7C140200, // 0002 CALL R5 1 - 0x8C140B00, // 0003 GETMET R5 R5 K0 - 0x7C140200, // 0004 CALL R5 1 - 0x90020201, // 0005 SETMBR R0 K1 R1 - 0x88140102, // 0006 GETMBR R5 R0 K2 - 0x8C140B03, // 0007 GETMET R5 R5 K3 - 0xB81E0800, // 0008 GETNGBL R7 K4 - 0x8C1C0F05, // 0009 GETMET R7 R7 K5 - 0x5C240400, // 000A MOVE R9 R2 - 0x5C280600, // 000B MOVE R10 R3 - 0x5C2C0800, // 000C MOVE R11 R4 - 0x7C1C0800, // 000D CALL R7 4 - 0x7C140400, // 000E CALL R5 2 - 0x88140102, // 000F GETMBR R5 R0 K2 - 0x8C140B03, // 0010 GETMET R5 R5 K3 - 0xB81E0800, // 0011 GETNGBL R7 K4 - 0x8C1C0F06, // 0012 GETMET R7 R7 K6 - 0x58240007, // 0013 LDCONST R9 K7 - 0x58280007, // 0014 LDCONST R10 K7 - 0x582C0007, // 0015 LDCONST R11 K7 - 0x7C1C0800, // 0016 CALL R7 4 - 0x7C140400, // 0017 CALL R5 2 - 0x80000000, // 0018 RET 0 + ( &(const binstruction[28]) { /* code */ + 0x60180003, // 0000 GETGBL R6 G3 + 0x5C1C0000, // 0001 MOVE R7 R0 + 0x7C180200, // 0002 CALL R6 1 + 0x8C180D00, // 0003 GETMET R6 R6 K0 + 0x7C180200, // 0004 CALL R6 1 + 0x8C180101, // 0005 GETMET R6 R0 K1 + 0x5C200200, // 0006 MOVE R8 R1 + 0x5C240400, // 0007 MOVE R9 R2 + 0x7C180600, // 0008 CALL R6 3 + 0x88180102, // 0009 GETMBR R6 R0 K2 + 0x8C180D03, // 000A GETMET R6 R6 K3 + 0xB8220800, // 000B GETNGBL R8 K4 + 0x8C201105, // 000C GETMET R8 R8 K5 + 0x5C280600, // 000D MOVE R10 R3 + 0x5C2C0800, // 000E MOVE R11 R4 + 0x5C300A00, // 000F MOVE R12 R5 + 0x7C200800, // 0010 CALL R8 4 + 0x7C180400, // 0011 CALL R6 2 + 0x88180102, // 0012 GETMBR R6 R0 K2 + 0x8C180D03, // 0013 GETMET R6 R6 K3 + 0xB8220800, // 0014 GETNGBL R8 K4 + 0x8C201106, // 0015 GETMET R8 R8 K6 + 0x58280007, // 0016 LDCONST R10 K7 + 0x582C0007, // 0017 LDCONST R11 K7 + 0x58300007, // 0018 LDCONST R12 K7 + 0x7C200800, // 0019 CALL R8 4 + 0x7C180400, // 001A CALL R6 2 + 0x80000000, // 001B RET 0 }) ) ); @@ -72,154 +970,9 @@ be_local_class(Animate_rotate, &be_class_Animate_engine, be_nested_map(1, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(init, -1), be_const_closure(Animate_rotate_init_closure) }, + { be_const_key_weak(init, -1), be_const_closure(Animate_rotate_init_closure) }, })), - (bstring*) &be_const_str_Animate_rotate -); - -extern const bclass be_class_Animate_from_to; - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Animate_from_to_init, /* name */ - be_nested_proto( - 12, /* nstack */ - 5, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str(init), - /* K1 */ be_nested_str(closure), - /* K2 */ be_nested_str(code), - /* K3 */ be_nested_str(push), - /* K4 */ be_nested_str(animate), - /* K5 */ be_nested_str(ins_ramp), - }), - &be_const_str_init, - &be_const_str_solidified, - ( &(const binstruction[16]) { /* code */ - 0x60140003, // 0000 GETGBL R5 G3 - 0x5C180000, // 0001 MOVE R6 R0 - 0x7C140200, // 0002 CALL R5 1 - 0x8C140B00, // 0003 GETMET R5 R5 K0 - 0x7C140200, // 0004 CALL R5 1 - 0x90020201, // 0005 SETMBR R0 K1 R1 - 0x88140102, // 0006 GETMBR R5 R0 K2 - 0x8C140B03, // 0007 GETMET R5 R5 K3 - 0xB81E0800, // 0008 GETNGBL R7 K4 - 0x8C1C0F05, // 0009 GETMET R7 R7 K5 - 0x5C240400, // 000A MOVE R9 R2 - 0x5C280600, // 000B MOVE R10 R3 - 0x5C2C0800, // 000C MOVE R11 R4 - 0x7C1C0800, // 000D CALL R7 4 - 0x7C140400, // 000E CALL R5 2 - 0x80000000, // 000F RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified class: Animate_from_to -********************************************************************/ -extern const bclass be_class_Animate_engine; -be_local_class(Animate_from_to, - 0, - &be_class_Animate_engine, - be_nested_map(1, - ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(init, -1), be_const_closure(Animate_from_to_init_closure) }, - })), - (bstring*) &be_const_str_Animate_from_to -); - -extern const bclass be_class_Animate_back_forth; - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Animate_back_forth_init, /* name */ - be_nested_proto( - 12, /* nstack */ - 5, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 9]) { /* constants */ - /* K0 */ be_nested_str(init), - /* K1 */ be_nested_str(closure), - /* K2 */ be_nested_str(code), - /* K3 */ be_nested_str(push), - /* K4 */ be_nested_str(animate), - /* K5 */ be_nested_str(ins_ramp), - /* K6 */ be_const_int(2), - /* K7 */ be_nested_str(ins_goto), - /* K8 */ be_const_int(0), - }), - &be_const_str_init, - &be_const_str_solidified, - ( &(const binstruction[34]) { /* code */ - 0x60140003, // 0000 GETGBL R5 G3 - 0x5C180000, // 0001 MOVE R6 R0 - 0x7C140200, // 0002 CALL R5 1 - 0x8C140B00, // 0003 GETMET R5 R5 K0 - 0x7C140200, // 0004 CALL R5 1 - 0x90020201, // 0005 SETMBR R0 K1 R1 - 0x88140102, // 0006 GETMBR R5 R0 K2 - 0x8C140B03, // 0007 GETMET R5 R5 K3 - 0xB81E0800, // 0008 GETNGBL R7 K4 - 0x8C1C0F05, // 0009 GETMET R7 R7 K5 - 0x5C240400, // 000A MOVE R9 R2 - 0x5C280600, // 000B MOVE R10 R3 - 0x0C2C0906, // 000C DIV R11 R4 K6 - 0x7C1C0800, // 000D CALL R7 4 - 0x7C140400, // 000E CALL R5 2 - 0x88140102, // 000F GETMBR R5 R0 K2 - 0x8C140B03, // 0010 GETMET R5 R5 K3 - 0xB81E0800, // 0011 GETNGBL R7 K4 - 0x8C1C0F05, // 0012 GETMET R7 R7 K5 - 0x5C240600, // 0013 MOVE R9 R3 - 0x5C280400, // 0014 MOVE R10 R2 - 0x0C2C0906, // 0015 DIV R11 R4 K6 - 0x7C1C0800, // 0016 CALL R7 4 - 0x7C140400, // 0017 CALL R5 2 - 0x88140102, // 0018 GETMBR R5 R0 K2 - 0x8C140B03, // 0019 GETMET R5 R5 K3 - 0xB81E0800, // 001A GETNGBL R7 K4 - 0x8C1C0F07, // 001B GETMET R7 R7 K7 - 0x58240008, // 001C LDCONST R9 K8 - 0x58280008, // 001D LDCONST R10 K8 - 0x582C0008, // 001E LDCONST R11 K8 - 0x7C1C0800, // 001F CALL R7 4 - 0x7C140400, // 0020 CALL R5 2 - 0x80000000, // 0021 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified class: Animate_back_forth -********************************************************************/ -extern const bclass be_class_Animate_engine; -be_local_class(Animate_back_forth, - 0, - &be_class_Animate_engine, - be_nested_map(1, - ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(init, -1), be_const_closure(Animate_back_forth_init_closure) }, - })), - (bstring*) &be_const_str_Animate_back_forth + be_str_weak(Animate_rotate) ); extern const bclass be_class_Animate_ins_goto; @@ -238,11 +991,11 @@ be_local_closure(Animate_ins_goto_init, /* name */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(pc_rel), - /* K1 */ be_nested_str(pc_abs), - /* K2 */ be_nested_str(duration), + /* K0 */ be_nested_str_weak(pc_rel), + /* K1 */ be_nested_str_weak(pc_abs), + /* K2 */ be_nested_str_weak(duration), }), - &be_const_str_init, + be_str_weak(init), &be_const_str_solidified, ( &(const binstruction[ 4]) { /* code */ 0x90020001, // 0000 SETMBR R0 K0 R1 @@ -263,12 +1016,12 @@ be_local_class(Animate_ins_goto, NULL, be_nested_map(4, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(pc_rel, -1), be_const_var(0) }, - { be_const_key(duration, -1), be_const_var(2) }, - { be_const_key(init, -1), be_const_closure(Animate_ins_goto_init_closure) }, - { be_const_key(pc_abs, 2), be_const_var(1) }, + { be_const_key_weak(pc_rel, -1), be_const_var(0) }, + { be_const_key_weak(duration, -1), be_const_var(2) }, + { be_const_key_weak(init, -1), be_const_closure(Animate_ins_goto_init_closure) }, + { be_const_key_weak(pc_abs, 2), be_const_var(1) }, })), - (bstring*) &be_const_str_Animate_ins_goto + be_str_weak(Animate_ins_goto) ); extern const bclass be_class_Animate_ins_ramp; @@ -287,11 +1040,11 @@ be_local_closure(Animate_ins_ramp_init, /* name */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(a), - /* K1 */ be_nested_str(b), - /* K2 */ be_nested_str(duration), + /* K0 */ be_nested_str_weak(a), + /* K1 */ be_nested_str_weak(b), + /* K2 */ be_nested_str_weak(duration), }), - &be_const_str_init, + be_str_weak(init), &be_const_str_solidified, ( &(const binstruction[ 4]) { /* code */ 0x90020001, // 0000 SETMBR R0 K0 R1 @@ -312,59 +1065,171 @@ be_local_class(Animate_ins_ramp, NULL, be_nested_map(4, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(a, -1), be_const_var(0) }, - { be_const_key(b, 2), be_const_var(1) }, - { be_const_key(duration, -1), be_const_var(2) }, - { be_const_key(init, -1), be_const_closure(Animate_ins_ramp_init_closure) }, + { be_const_key_weak(a, -1), be_const_var(0) }, + { be_const_key_weak(b, 2), be_const_var(1) }, + { be_const_key_weak(duration, -1), be_const_var(2) }, + { be_const_key_weak(init, -1), be_const_closure(Animate_ins_ramp_init_closure) }, })), - (bstring*) &be_const_str_Animate_ins_ramp + be_str_weak(Animate_ins_ramp) ); extern const bclass be_class_Animate_engine; /******************************************************************** -** Solidified function: run +** Solidified function: animate ********************************************************************/ -be_local_closure(Animate_engine_run, /* name */ +be_local_closure(Animate_engine_animate, /* name */ be_nested_proto( - 6, /* nstack */ - 3, /* argc */ + 14, /* nstack */ + 2, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str(tasmota), - /* K1 */ be_nested_str(millis), - /* K2 */ be_nested_str(value), - /* K3 */ be_nested_str(ins_time), - /* K4 */ be_nested_str(running), - /* K5 */ be_nested_str(add_driver), + ( &(const bvalue[24]) { /* constants */ + /* K0 */ be_nested_str_weak(running), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(millis), + /* K3 */ be_nested_str_weak(ins_time), + /* K4 */ be_nested_str_weak(pc), + /* K5 */ be_nested_str_weak(code), + /* K6 */ be_const_int(0), + /* K7 */ be_nested_str_weak(internal_error), + /* K8 */ be_nested_str_weak(Animate_X20pc_X20is_X20out_X20of_X20range), + /* K9 */ be_nested_str_weak(animate), + /* K10 */ be_nested_str_weak(ins_ramp), + /* K11 */ be_nested_str_weak(closure), + /* K12 */ be_nested_str_weak(animate_obj), + /* K13 */ be_nested_str_weak(animate_mth), + /* K14 */ be_nested_str_weak(duration), + /* K15 */ be_nested_str_weak(value), + /* K16 */ be_nested_str_weak(scale_uint), + /* K17 */ be_nested_str_weak(a), + /* K18 */ be_nested_str_weak(b), + /* K19 */ be_const_int(1), + /* K20 */ be_nested_str_weak(ins_goto), + /* K21 */ be_nested_str_weak(pc_rel), + /* K22 */ be_nested_str_weak(pc_abs), + /* K23 */ be_nested_str_weak(unknown_X20instruction), }), - &be_const_str_run, + be_str_weak(animate), &be_const_str_solidified, - ( &(const binstruction[19]) { /* code */ - 0x4C0C0000, // 0000 LDNIL R3 - 0x1C0C0203, // 0001 EQ R3 R1 R3 - 0x780E0003, // 0002 JMPF R3 #0007 - 0xB80E0000, // 0003 GETNGBL R3 K0 - 0x8C0C0701, // 0004 GETMET R3 R3 K1 - 0x7C0C0200, // 0005 CALL R3 1 - 0x5C040600, // 0006 MOVE R1 R3 - 0x4C0C0000, // 0007 LDNIL R3 - 0x200C0403, // 0008 NE R3 R2 R3 - 0x780E0000, // 0009 JMPF R3 #000B - 0x90020402, // 000A SETMBR R0 K2 R2 - 0x90020601, // 000B SETMBR R0 K3 R1 - 0x500C0200, // 000C LDBOOL R3 1 0 - 0x90020803, // 000D SETMBR R0 K4 R3 - 0xB80E0000, // 000E GETNGBL R3 K0 - 0x8C0C0705, // 000F GETMET R3 R3 K5 - 0x5C140000, // 0010 MOVE R5 R0 - 0x7C0C0400, // 0011 CALL R3 2 - 0x80000000, // 0012 RET 0 + ( &(const binstruction[113]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x740A0000, // 0001 JMPT R2 #0003 + 0x80000400, // 0002 RET 0 + 0x4C080000, // 0003 LDNIL R2 + 0x1C080202, // 0004 EQ R2 R1 R2 + 0x780A0003, // 0005 JMPF R2 #000A + 0xB80A0200, // 0006 GETNGBL R2 K1 + 0x8C080502, // 0007 GETMET R2 R2 K2 + 0x7C080200, // 0008 CALL R2 1 + 0x5C040400, // 0009 MOVE R1 R2 + 0x50080200, // 000A LDBOOL R2 1 0 + 0x780A0062, // 000B JMPF R2 #006F + 0x88080103, // 000C GETMBR R2 R0 K3 + 0x04080202, // 000D SUB R2 R1 R2 + 0x880C0104, // 000E GETMBR R3 R0 K4 + 0x6010000C, // 000F GETGBL R4 G12 + 0x88140105, // 0010 GETMBR R5 R0 K5 + 0x7C100200, // 0011 CALL R4 1 + 0x280C0604, // 0012 GE R3 R3 R4 + 0x780E0002, // 0013 JMPF R3 #0017 + 0x500C0000, // 0014 LDBOOL R3 0 0 + 0x90020003, // 0015 SETMBR R0 K0 R3 + 0x70020057, // 0016 JMP #006F + 0x880C0104, // 0017 GETMBR R3 R0 K4 + 0x140C0706, // 0018 LT R3 R3 K6 + 0x780E0000, // 0019 JMPF R3 #001B + 0xB0060F08, // 001A RAISE 1 K7 K8 + 0x880C0105, // 001B GETMBR R3 R0 K5 + 0x88100104, // 001C GETMBR R4 R0 K4 + 0x940C0604, // 001D GETIDX R3 R3 R4 + 0x6010000F, // 001E GETGBL R4 G15 + 0x5C140600, // 001F MOVE R5 R3 + 0xB81A1200, // 0020 GETNGBL R6 K9 + 0x88180D0A, // 0021 GETMBR R6 R6 K10 + 0x7C100400, // 0022 CALL R4 2 + 0x7812002E, // 0023 JMPF R4 #0053 + 0x8810010B, // 0024 GETMBR R4 R0 K11 + 0x8814010C, // 0025 GETMBR R5 R0 K12 + 0x8818010D, // 0026 GETMBR R6 R0 K13 + 0x881C070E, // 0027 GETMBR R7 R3 K14 + 0x141C0407, // 0028 LT R7 R2 R7 + 0x781E0014, // 0029 JMPF R7 #003F + 0xB81E0200, // 002A GETNGBL R7 K1 + 0x8C1C0F10, // 002B GETMET R7 R7 K16 + 0x5C240400, // 002C MOVE R9 R2 + 0x58280006, // 002D LDCONST R10 K6 + 0x882C070E, // 002E GETMBR R11 R3 K14 + 0x88300711, // 002F GETMBR R12 R3 K17 + 0x88340712, // 0030 GETMBR R13 R3 K18 + 0x7C1C0C00, // 0031 CALL R7 6 + 0x90021E07, // 0032 SETMBR R0 K15 R7 + 0x78160004, // 0033 JMPF R5 #0039 + 0x781A0003, // 0034 JMPF R6 #0039 + 0x5C1C0C00, // 0035 MOVE R7 R6 + 0x5C200A00, // 0036 MOVE R8 R5 + 0x8824010F, // 0037 GETMBR R9 R0 K15 + 0x7C1C0400, // 0038 CALL R7 2 + 0x78120002, // 0039 JMPF R4 #003D + 0x5C1C0800, // 003A MOVE R7 R4 + 0x8820010F, // 003B GETMBR R8 R0 K15 + 0x7C1C0200, // 003C CALL R7 1 + 0x70020030, // 003D JMP #006F + 0x70020012, // 003E JMP #0052 + 0x881C0712, // 003F GETMBR R7 R3 K18 + 0x90021E07, // 0040 SETMBR R0 K15 R7 + 0x78160004, // 0041 JMPF R5 #0047 + 0x781A0003, // 0042 JMPF R6 #0047 + 0x5C1C0C00, // 0043 MOVE R7 R6 + 0x5C200A00, // 0044 MOVE R8 R5 + 0x8824010F, // 0045 GETMBR R9 R0 K15 + 0x7C1C0400, // 0046 CALL R7 2 + 0x78120002, // 0047 JMPF R4 #004B + 0x5C1C0800, // 0048 MOVE R7 R4 + 0x8820010F, // 0049 GETMBR R8 R0 K15 + 0x7C1C0200, // 004A CALL R7 1 + 0x881C0104, // 004B GETMBR R7 R0 K4 + 0x001C0F13, // 004C ADD R7 R7 K19 + 0x90020807, // 004D SETMBR R0 K4 R7 + 0x881C070E, // 004E GETMBR R7 R3 K14 + 0x041C0407, // 004F SUB R7 R2 R7 + 0x041C0207, // 0050 SUB R7 R1 R7 + 0x90020607, // 0051 SETMBR R0 K3 R7 + 0x7002001A, // 0052 JMP #006E + 0x6010000F, // 0053 GETGBL R4 G15 + 0x5C140600, // 0054 MOVE R5 R3 + 0xB81A1200, // 0055 GETNGBL R6 K9 + 0x88180D14, // 0056 GETMBR R6 R6 K20 + 0x7C100400, // 0057 CALL R4 2 + 0x78120013, // 0058 JMPF R4 #006D + 0x8810070E, // 0059 GETMBR R4 R3 K14 + 0x14100404, // 005A LT R4 R2 R4 + 0x78120001, // 005B JMPF R4 #005E + 0x70020011, // 005C JMP #006F + 0x7002000D, // 005D JMP #006C + 0x88100715, // 005E GETMBR R4 R3 K21 + 0x20100906, // 005F NE R4 R4 K6 + 0x78120004, // 0060 JMPF R4 #0066 + 0x88100104, // 0061 GETMBR R4 R0 K4 + 0x88140715, // 0062 GETMBR R5 R3 K21 + 0x00100805, // 0063 ADD R4 R4 R5 + 0x90020804, // 0064 SETMBR R0 K4 R4 + 0x70020001, // 0065 JMP #0068 + 0x88100716, // 0066 GETMBR R4 R3 K22 + 0x90020804, // 0067 SETMBR R0 K4 R4 + 0x8810070E, // 0068 GETMBR R4 R3 K14 + 0x04100404, // 0069 SUB R4 R2 R4 + 0x04100204, // 006A SUB R4 R1 R4 + 0x90020604, // 006B SETMBR R0 K3 R4 + 0x70020000, // 006C JMP #006E + 0xB0060F17, // 006D RAISE 1 K7 K23 + 0x7001FF9A, // 006E JMP #000A + 0x8808010F, // 006F GETMBR R2 R0 K15 + 0x80040400, // 0070 RET 1 R2 }) ) ); @@ -385,13 +1250,13 @@ be_local_closure(Animate_engine_init, /* name */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str(code), - /* K1 */ be_nested_str(pc), + /* K0 */ be_nested_str_weak(code), + /* K1 */ be_nested_str_weak(pc), /* K2 */ be_const_int(0), - /* K3 */ be_nested_str(ins_time), - /* K4 */ be_nested_str(running), + /* K3 */ be_nested_str_weak(ins_time), + /* K4 */ be_nested_str_weak(running), }), - &be_const_str_init, + be_str_weak(init), &be_const_str_solidified, ( &(const binstruction[ 8]) { /* code */ 0x60040012, // 0000 GETGBL R1 G18 @@ -408,48 +1273,12 @@ be_local_closure(Animate_engine_init, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: autorun -********************************************************************/ -be_local_closure(Animate_engine_autorun, /* name */ - be_nested_proto( - 7, /* nstack */ - 3, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(run), - /* K1 */ be_nested_str(tasmota), - /* K2 */ be_nested_str(add_driver), - }), - &be_const_str_autorun, - &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ - 0x8C0C0100, // 0000 GETMET R3 R0 K0 - 0x5C140200, // 0001 MOVE R5 R1 - 0x5C180400, // 0002 MOVE R6 R2 - 0x7C0C0600, // 0003 CALL R3 3 - 0xB80E0200, // 0004 GETNGBL R3 K1 - 0x8C0C0702, // 0005 GETMET R3 R3 K2 - 0x5C140000, // 0006 MOVE R5 R0 - 0x7C0C0400, // 0007 CALL R3 2 - 0x80000000, // 0008 RET 0 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified function: stop ********************************************************************/ be_local_closure(Animate_engine_stop, /* name */ be_nested_proto( - 4, /* nstack */ + 2, /* nstack */ 1, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -457,21 +1286,15 @@ be_local_closure(Animate_engine_stop, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(running), - /* K1 */ be_nested_str(tasmota), - /* K2 */ be_nested_str(remove_driver), + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(running), }), - &be_const_str_stop, + be_str_weak(stop), &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ + ( &(const binstruction[ 3]) { /* code */ 0x50040000, // 0000 LDBOOL R1 0 0 0x90020001, // 0001 SETMBR R0 K0 R1 - 0xB8060200, // 0002 GETNGBL R1 K1 - 0x8C040302, // 0003 GETMET R1 R1 K2 - 0x5C0C0000, // 0004 MOVE R3 R0 - 0x7C040400, // 0005 CALL R1 2 - 0x80000000, // 0006 RET 0 + 0x80000000, // 0002 RET 0 }) ) ); @@ -492,9 +1315,9 @@ be_local_closure(Animate_engine_is_running, /* name */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(running), + /* K0 */ be_nested_str_weak(running), }), - &be_const_str_is_running, + be_str_weak(is_running), &be_const_str_solidified, ( &(const binstruction[ 2]) { /* code */ 0x88040100, // 0000 GETMBR R1 R0 K0 @@ -506,26 +1329,27 @@ be_local_closure(Animate_engine_is_running, /* name */ /******************************************************************** -** Solidified function: every_50ms +** Solidified function: set_cb ********************************************************************/ -be_local_closure(Animate_engine_every_50ms, /* name */ +be_local_closure(Animate_engine_set_cb, /* name */ be_nested_proto( 3, /* nstack */ - 1, /* argc */ + 3, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(animate), + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(animate_obj), + /* K1 */ be_nested_str_weak(animate_mth), }), - &be_const_str_every_50ms, + be_str_weak(set_cb), &be_const_str_solidified, ( &(const binstruction[ 3]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x7C040200, // 0001 CALL R1 1 + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x90020202, // 0001 SETMBR R0 K1 R2 0x80000000, // 0002 RET 0 }) ) @@ -534,144 +1358,43 @@ be_local_closure(Animate_engine_every_50ms, /* name */ /******************************************************************** -** Solidified function: animate +** Solidified function: start ********************************************************************/ -be_local_closure(Animate_engine_animate, /* name */ +be_local_closure(Animate_engine_start, /* name */ be_nested_proto( - 12, /* nstack */ - 2, /* argc */ + 5, /* nstack */ + 3, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[22]) { /* constants */ - /* K0 */ be_nested_str(running), - /* K1 */ be_nested_str(tasmota), - /* K2 */ be_nested_str(millis), - /* K3 */ be_nested_str(ins_time), - /* K4 */ be_nested_str(pc), - /* K5 */ be_nested_str(code), - /* K6 */ be_const_int(0), - /* K7 */ be_nested_str(internal_error), - /* K8 */ be_nested_str(Animate_X20pc_X20is_X20out_X20of_X20range), - /* K9 */ be_nested_str(animate), - /* K10 */ be_nested_str(ins_ramp), - /* K11 */ be_nested_str(closure), - /* K12 */ be_nested_str(duration), - /* K13 */ be_nested_str(value), - /* K14 */ be_nested_str(scale_uint), - /* K15 */ be_nested_str(a), - /* K16 */ be_nested_str(b), - /* K17 */ be_const_int(1), - /* K18 */ be_nested_str(ins_goto), - /* K19 */ be_nested_str(pc_rel), - /* K20 */ be_nested_str(pc_abs), - /* K21 */ be_nested_str(unknown_X20instruction), + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(tasmota), + /* K1 */ be_nested_str_weak(millis), + /* K2 */ be_nested_str_weak(value), + /* K3 */ be_nested_str_weak(ins_time), + /* K4 */ be_nested_str_weak(running), }), - &be_const_str_animate, + be_str_weak(start), &be_const_str_solidified, - ( &(const binstruction[99]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x740A0000, // 0001 JMPT R2 #0003 - 0x80000400, // 0002 RET 0 - 0x4C080000, // 0003 LDNIL R2 - 0x1C080202, // 0004 EQ R2 R1 R2 - 0x780A0003, // 0005 JMPF R2 #000A - 0xB80A0200, // 0006 GETNGBL R2 K1 - 0x8C080502, // 0007 GETMET R2 R2 K2 - 0x7C080200, // 0008 CALL R2 1 - 0x5C040400, // 0009 MOVE R1 R2 - 0x50080200, // 000A LDBOOL R2 1 0 - 0x780A0054, // 000B JMPF R2 #0061 - 0x88080103, // 000C GETMBR R2 R0 K3 - 0x04080202, // 000D SUB R2 R1 R2 - 0x880C0104, // 000E GETMBR R3 R0 K4 - 0x6010000C, // 000F GETGBL R4 G12 - 0x88140105, // 0010 GETMBR R5 R0 K5 - 0x7C100200, // 0011 CALL R4 1 - 0x280C0604, // 0012 GE R3 R3 R4 - 0x780E0002, // 0013 JMPF R3 #0017 - 0x500C0000, // 0014 LDBOOL R3 0 0 - 0x90020003, // 0015 SETMBR R0 K0 R3 - 0x70020049, // 0016 JMP #0061 - 0x880C0104, // 0017 GETMBR R3 R0 K4 - 0x140C0706, // 0018 LT R3 R3 K6 - 0x780E0000, // 0019 JMPF R3 #001B - 0xB0060F08, // 001A RAISE 1 K7 K8 - 0x880C0105, // 001B GETMBR R3 R0 K5 - 0x88100104, // 001C GETMBR R4 R0 K4 - 0x940C0604, // 001D GETIDX R3 R3 R4 - 0x6010000F, // 001E GETGBL R4 G15 - 0x5C140600, // 001F MOVE R5 R3 - 0xB81A1200, // 0020 GETNGBL R6 K9 - 0x88180D0A, // 0021 GETMBR R6 R6 K10 - 0x7C100400, // 0022 CALL R4 2 - 0x78120020, // 0023 JMPF R4 #0045 - 0x8810010B, // 0024 GETMBR R4 R0 K11 - 0x8814070C, // 0025 GETMBR R5 R3 K12 - 0x14140405, // 0026 LT R5 R2 R5 - 0x7816000E, // 0027 JMPF R5 #0037 - 0xB8160200, // 0028 GETNGBL R5 K1 - 0x8C140B0E, // 0029 GETMET R5 R5 K14 - 0x5C1C0400, // 002A MOVE R7 R2 - 0x58200006, // 002B LDCONST R8 K6 - 0x8824070C, // 002C GETMBR R9 R3 K12 - 0x8828070F, // 002D GETMBR R10 R3 K15 - 0x882C0710, // 002E GETMBR R11 R3 K16 - 0x7C140C00, // 002F CALL R5 6 - 0x90021A05, // 0030 SETMBR R0 K13 R5 - 0x78120002, // 0031 JMPF R4 #0035 - 0x5C140800, // 0032 MOVE R5 R4 - 0x8818010D, // 0033 GETMBR R6 R0 K13 - 0x7C140200, // 0034 CALL R5 1 - 0x7002002A, // 0035 JMP #0061 - 0x7002000C, // 0036 JMP #0044 - 0x88140710, // 0037 GETMBR R5 R3 K16 - 0x90021A05, // 0038 SETMBR R0 K13 R5 - 0x78120002, // 0039 JMPF R4 #003D - 0x5C140800, // 003A MOVE R5 R4 - 0x8818010D, // 003B GETMBR R6 R0 K13 - 0x7C140200, // 003C CALL R5 1 - 0x88140104, // 003D GETMBR R5 R0 K4 - 0x00140B11, // 003E ADD R5 R5 K17 - 0x90020805, // 003F SETMBR R0 K4 R5 - 0x8814070C, // 0040 GETMBR R5 R3 K12 - 0x04140405, // 0041 SUB R5 R2 R5 - 0x04140205, // 0042 SUB R5 R1 R5 - 0x90020605, // 0043 SETMBR R0 K3 R5 - 0x7002001A, // 0044 JMP #0060 - 0x6010000F, // 0045 GETGBL R4 G15 - 0x5C140600, // 0046 MOVE R5 R3 - 0xB81A1200, // 0047 GETNGBL R6 K9 - 0x88180D12, // 0048 GETMBR R6 R6 K18 - 0x7C100400, // 0049 CALL R4 2 - 0x78120013, // 004A JMPF R4 #005F - 0x8810070C, // 004B GETMBR R4 R3 K12 - 0x14100404, // 004C LT R4 R2 R4 - 0x78120001, // 004D JMPF R4 #0050 - 0x70020011, // 004E JMP #0061 - 0x7002000D, // 004F JMP #005E - 0x88100713, // 0050 GETMBR R4 R3 K19 - 0x20100906, // 0051 NE R4 R4 K6 - 0x78120004, // 0052 JMPF R4 #0058 - 0x88100104, // 0053 GETMBR R4 R0 K4 - 0x88140713, // 0054 GETMBR R5 R3 K19 - 0x00100805, // 0055 ADD R4 R4 R5 - 0x90020804, // 0056 SETMBR R0 K4 R4 - 0x70020001, // 0057 JMP #005A - 0x88100714, // 0058 GETMBR R4 R3 K20 - 0x90020804, // 0059 SETMBR R0 K4 R4 - 0x8810070C, // 005A GETMBR R4 R3 K12 - 0x04100404, // 005B SUB R4 R2 R4 - 0x04100204, // 005C SUB R4 R1 R4 - 0x90020604, // 005D SETMBR R0 K3 R4 - 0x70020000, // 005E JMP #0060 - 0xB0060F15, // 005F RAISE 1 K7 K21 - 0x7001FFA8, // 0060 JMP #000A - 0x8808010D, // 0061 GETMBR R2 R0 K13 - 0x80040400, // 0062 RET 1 R2 + ( &(const binstruction[15]) { /* code */ + 0x4C0C0000, // 0000 LDNIL R3 + 0x1C0C0203, // 0001 EQ R3 R1 R3 + 0x780E0003, // 0002 JMPF R3 #0007 + 0xB80E0000, // 0003 GETNGBL R3 K0 + 0x8C0C0701, // 0004 GETMET R3 R3 K1 + 0x7C0C0200, // 0005 CALL R3 1 + 0x5C040600, // 0006 MOVE R1 R3 + 0x4C0C0000, // 0007 LDNIL R3 + 0x200C0403, // 0008 NE R3 R2 R3 + 0x780E0000, // 0009 JMPF R3 #000B + 0x90020402, // 000A SETMBR R0 K2 R2 + 0x90020601, // 000B SETMBR R0 K3 R1 + 0x500C0200, // 000C LDBOOL R3 1 0 + 0x90020803, // 000D SETMBR R0 K4 R3 + 0x80000000, // 000E RET 0 }) ) ); @@ -682,25 +1405,176 @@ be_local_closure(Animate_engine_animate, /* name */ ** Solidified class: Animate_engine ********************************************************************/ be_local_class(Animate_engine, - 6, + 8, NULL, - be_nested_map(13, + be_nested_map(14, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(code, -1), be_const_var(0) }, - { be_const_key(run, 9), be_const_closure(Animate_engine_run_closure) }, - { be_const_key(running, 4), be_const_var(4) }, - { be_const_key(ins_time, 8), be_const_var(3) }, - { be_const_key(closure, 10), be_const_var(1) }, - { be_const_key(value, -1), be_const_var(5) }, - { be_const_key(init, 11), be_const_closure(Animate_engine_init_closure) }, - { be_const_key(pc, -1), be_const_var(2) }, - { be_const_key(animate, -1), be_const_closure(Animate_engine_animate_closure) }, - { be_const_key(autorun, -1), be_const_closure(Animate_engine_autorun_closure) }, - { be_const_key(is_running, -1), be_const_closure(Animate_engine_is_running_closure) }, - { be_const_key(stop, -1), be_const_closure(Animate_engine_stop_closure) }, - { be_const_key(every_50ms, 3), be_const_closure(Animate_engine_every_50ms_closure) }, + { be_const_key_weak(animate, -1), be_const_closure(Animate_engine_animate_closure) }, + { be_const_key_weak(ins_time, -1), be_const_var(5) }, + { be_const_key_weak(running, 10), be_const_var(6) }, + { be_const_key_weak(stop, 7), be_const_closure(Animate_engine_stop_closure) }, + { be_const_key_weak(closure, -1), be_const_var(1) }, + { be_const_key_weak(init, 1), be_const_closure(Animate_engine_init_closure) }, + { be_const_key_weak(animate_mth, -1), be_const_var(3) }, + { be_const_key_weak(set_cb, -1), be_const_closure(Animate_engine_set_cb_closure) }, + { be_const_key_weak(code, -1), be_const_var(0) }, + { be_const_key_weak(is_running, -1), be_const_closure(Animate_engine_is_running_closure) }, + { be_const_key_weak(animate_obj, 11), be_const_var(2) }, + { be_const_key_weak(pc, -1), be_const_var(4) }, + { be_const_key_weak(value, 6), be_const_var(7) }, + { be_const_key_weak(start, -1), be_const_closure(Animate_engine_start_closure) }, })), - (bstring*) &be_const_str_Animate_engine + be_str_weak(Animate_engine) +); + +extern const bclass be_class_Animate_back_forth; + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Animate_back_forth_init, /* name */ + be_nested_proto( + 13, /* nstack */ + 6, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str_weak(init), + /* K1 */ be_nested_str_weak(set_cb), + /* K2 */ be_nested_str_weak(code), + /* K3 */ be_nested_str_weak(push), + /* K4 */ be_nested_str_weak(animate), + /* K5 */ be_nested_str_weak(ins_ramp), + /* K6 */ be_nested_str_weak(ins_goto), + /* K7 */ be_const_int(0), + }), + be_str_weak(init), + &be_const_str_solidified, + ( &(const binstruction[37]) { /* code */ + 0x60180003, // 0000 GETGBL R6 G3 + 0x5C1C0000, // 0001 MOVE R7 R0 + 0x7C180200, // 0002 CALL R6 1 + 0x8C180D00, // 0003 GETMET R6 R6 K0 + 0x7C180200, // 0004 CALL R6 1 + 0x8C180101, // 0005 GETMET R6 R0 K1 + 0x5C200200, // 0006 MOVE R8 R1 + 0x5C240400, // 0007 MOVE R9 R2 + 0x7C180600, // 0008 CALL R6 3 + 0x88180102, // 0009 GETMBR R6 R0 K2 + 0x8C180D03, // 000A GETMET R6 R6 K3 + 0xB8220800, // 000B GETNGBL R8 K4 + 0x8C201105, // 000C GETMET R8 R8 K5 + 0x5C280600, // 000D MOVE R10 R3 + 0x5C2C0800, // 000E MOVE R11 R4 + 0x5C300A00, // 000F MOVE R12 R5 + 0x7C200800, // 0010 CALL R8 4 + 0x7C180400, // 0011 CALL R6 2 + 0x88180102, // 0012 GETMBR R6 R0 K2 + 0x8C180D03, // 0013 GETMET R6 R6 K3 + 0xB8220800, // 0014 GETNGBL R8 K4 + 0x8C201105, // 0015 GETMET R8 R8 K5 + 0x5C280800, // 0016 MOVE R10 R4 + 0x5C2C0600, // 0017 MOVE R11 R3 + 0x5C300A00, // 0018 MOVE R12 R5 + 0x7C200800, // 0019 CALL R8 4 + 0x7C180400, // 001A CALL R6 2 + 0x88180102, // 001B GETMBR R6 R0 K2 + 0x8C180D03, // 001C GETMET R6 R6 K3 + 0xB8220800, // 001D GETNGBL R8 K4 + 0x8C201106, // 001E GETMET R8 R8 K6 + 0x58280007, // 001F LDCONST R10 K7 + 0x582C0007, // 0020 LDCONST R11 K7 + 0x58300007, // 0021 LDCONST R12 K7 + 0x7C200800, // 0022 CALL R8 4 + 0x7C180400, // 0023 CALL R6 2 + 0x80000000, // 0024 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Animate_back_forth +********************************************************************/ +extern const bclass be_class_Animate_engine; +be_local_class(Animate_back_forth, + 0, + &be_class_Animate_engine, + be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(init, -1), be_const_closure(Animate_back_forth_init_closure) }, + })), + be_str_weak(Animate_back_forth) +); + +extern const bclass be_class_Animate_from_to; + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Animate_from_to_init, /* name */ + be_nested_proto( + 13, /* nstack */ + 6, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str_weak(init), + /* K1 */ be_nested_str_weak(set_cb), + /* K2 */ be_nested_str_weak(code), + /* K3 */ be_nested_str_weak(push), + /* K4 */ be_nested_str_weak(animate), + /* K5 */ be_nested_str_weak(ins_ramp), + }), + be_str_weak(init), + &be_const_str_solidified, + ( &(const binstruction[19]) { /* code */ + 0x60180003, // 0000 GETGBL R6 G3 + 0x5C1C0000, // 0001 MOVE R7 R0 + 0x7C180200, // 0002 CALL R6 1 + 0x8C180D00, // 0003 GETMET R6 R6 K0 + 0x7C180200, // 0004 CALL R6 1 + 0x8C180101, // 0005 GETMET R6 R0 K1 + 0x5C200200, // 0006 MOVE R8 R1 + 0x5C240400, // 0007 MOVE R9 R2 + 0x7C180600, // 0008 CALL R6 3 + 0x88180102, // 0009 GETMBR R6 R0 K2 + 0x8C180D03, // 000A GETMET R6 R6 K3 + 0xB8220800, // 000B GETNGBL R8 K4 + 0x8C201105, // 000C GETMET R8 R8 K5 + 0x5C280600, // 000D MOVE R10 R3 + 0x5C2C0800, // 000E MOVE R11 R4 + 0x5C300A00, // 000F MOVE R12 R5 + 0x7C200800, // 0010 CALL R8 4 + 0x7C180400, // 0011 CALL R6 2 + 0x80000000, // 0012 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Animate_from_to +********************************************************************/ +extern const bclass be_class_Animate_engine; +be_local_class(Animate_from_to, + 0, + &be_class_Animate_engine, + be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(init, -1), be_const_closure(Animate_from_to_init_closure) }, + })), + be_str_weak(Animate_from_to) ); /******************************************************************** @@ -708,14 +1582,15 @@ be_local_class(Animate_engine, ********************************************************************/ be_local_module(animate, "animate", - be_nested_map(6, + be_nested_map(7, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(rotate, 2), be_const_class(be_class_Animate_rotate) }, - { be_const_key(from_to, 3), be_const_class(be_class_Animate_from_to) }, - { be_const_key(back_forth, -1), be_const_class(be_class_Animate_back_forth) }, - { be_const_key(ins_goto, -1), be_const_class(be_class_Animate_ins_goto) }, - { be_const_key(ins_ramp, -1), be_const_class(be_class_Animate_ins_ramp) }, - { be_const_key(engine, -1), be_const_class(be_class_Animate_engine) }, + { be_const_key_weak(ins_ramp, -1), be_const_class(be_class_Animate_ins_ramp) }, + { be_const_key_weak(from_to, -1), be_const_class(be_class_Animate_from_to) }, + { be_const_key_weak(palette, 3), be_const_class(be_class_Animate_palette) }, + { be_const_key_weak(engine, 5), be_const_class(be_class_Animate_engine) }, + { be_const_key_weak(back_forth, -1), be_const_class(be_class_Animate_back_forth) }, + { be_const_key_weak(rotate, -1), be_const_class(be_class_Animate_rotate) }, + { be_const_key_weak(ins_goto, -1), be_const_class(be_class_Animate_ins_goto) }, })) ); BE_EXPORT_VARIABLE be_define_const_native_module(animate); diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds.h index 13b452935..ef3af9aba 100644 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds.h +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds.h @@ -6,35 +6,6 @@ extern const bclass be_class_Leds; -/******************************************************************** -** Solidified function: pixel_count -********************************************************************/ -be_local_closure(Leds_pixel_count, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(call_native), - }), - &be_const_str_pixel_count, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x540E0007, // 0001 LDINT R3 8 - 0x7C040400, // 0002 CALL R1 2 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified function: show ********************************************************************/ @@ -65,81 +36,14 @@ be_local_closure(Leds_show, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: clear_to -********************************************************************/ -be_local_closure(Leds_clear_to, /* name */ - be_nested_proto( - 10, /* nstack */ - 3, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(call_native), - /* K1 */ be_nested_str(to_gamma), - }), - &be_const_str_clear_to, - &be_const_str_solidified, - ( &(const binstruction[ 8]) { /* code */ - 0x8C0C0100, // 0000 GETMET R3 R0 K0 - 0x54160008, // 0001 LDINT R5 9 - 0x8C180101, // 0002 GETMET R6 R0 K1 - 0x5C200200, // 0003 MOVE R8 R1 - 0x5C240400, // 0004 MOVE R9 R2 - 0x7C180600, // 0005 CALL R6 3 - 0x7C0C0600, // 0006 CALL R3 3 - 0x80000000, // 0007 RET 0 - }) - ) -); -/*******************************************************************/ - +extern const bclass be_class_Leds_segment; /******************************************************************** -** Solidified function: set_pixel_color +** Solidified function: pixel_offset ********************************************************************/ -be_local_closure(Leds_set_pixel_color, /* name */ +be_local_closure(Leds_segment_pixel_offset, /* name */ be_nested_proto( - 12, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(call_native), - /* K1 */ be_nested_str(to_gamma), - }), - &be_const_str_set_pixel_color, - &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ - 0x8C100100, // 0000 GETMET R4 R0 K0 - 0x541A0009, // 0001 LDINT R6 10 - 0x5C1C0200, // 0002 MOVE R7 R1 - 0x8C200101, // 0003 GETMET R8 R0 K1 - 0x5C280400, // 0004 MOVE R10 R2 - 0x5C2C0600, // 0005 MOVE R11 R3 - 0x7C200600, // 0006 CALL R8 3 - 0x7C100800, // 0007 CALL R4 4 - 0x80000000, // 0008 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: clear -********************************************************************/ -be_local_closure(Leds_clear, /* name */ - be_nested_proto( - 4, /* nstack */ + 2, /* nstack */ 1, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -147,95 +51,14 @@ be_local_closure(Leds_clear, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(clear_to), - /* K1 */ be_const_int(0), - /* K2 */ be_nested_str(show), + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(offset), }), - &be_const_str_clear, + &be_const_str_pixel_offset, &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x580C0001, // 0001 LDCONST R3 K1 - 0x7C040400, // 0002 CALL R1 2 - 0x8C040102, // 0003 GETMET R1 R0 K2 - 0x7C040200, // 0004 CALL R1 1 - 0x80000000, // 0005 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: matrix -********************************************************************/ -be_local_closure(Leds_matrix, /* name */ - be_nested_proto( - 11, /* nstack */ - 4, /* argc */ - 4, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_const_class(be_class_Leds), - /* K1 */ be_nested_str(Leds), - /* K2 */ be_nested_str(create_matrix), - /* K3 */ be_const_int(0), - }), - &be_const_str_matrix, - &be_const_str_solidified, - ( &(const binstruction[12]) { /* code */ - 0x58100000, // 0000 LDCONST R4 K0 - 0xB8160200, // 0001 GETNGBL R5 K1 - 0x08180001, // 0002 MUL R6 R0 R1 - 0x5C1C0400, // 0003 MOVE R7 R2 - 0x5C200600, // 0004 MOVE R8 R3 - 0x7C140600, // 0005 CALL R5 3 - 0x8C180B02, // 0006 GETMET R6 R5 K2 - 0x5C200000, // 0007 MOVE R8 R0 - 0x5C240200, // 0008 MOVE R9 R1 - 0x58280003, // 0009 LDCONST R10 K3 - 0x7C180800, // 000A CALL R6 4 - 0x80040C00, // 000B RET 1 R6 - }) - ) -); -/*******************************************************************/ - - -extern const bclass be_class_Leds_segment; - -/******************************************************************** -** Solidified function: get_pixel_color -********************************************************************/ -be_local_closure(Leds_segment_get_pixel_color, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(get_pixel_color), - /* K2 */ be_nested_str(offseta), - }), - &be_const_str_get_pixel_color, - &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x88100102, // 0002 GETMBR R4 R0 K2 - 0x00100204, // 0003 ADD R4 R1 R4 - 0x7C080400, // 0004 CALL R2 2 - 0x80040400, // 0005 RET 1 R2 + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 }) ) ); @@ -247,7 +70,7 @@ be_local_closure(Leds_segment_get_pixel_color, /* name */ ********************************************************************/ be_local_closure(Leds_segment_clear_to, /* name */ be_nested_proto( - 9, /* nstack */ + 10, /* nstack */ 3, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -255,31 +78,110 @@ be_local_closure(Leds_segment_clear_to, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_const_int(0), - /* K1 */ be_nested_str(leds), - /* K2 */ be_nested_str(strip), - /* K3 */ be_nested_str(set_pixel_color), - /* K4 */ be_nested_str(offset), - /* K5 */ be_const_int(1), + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(call_native), + /* K2 */ be_nested_str(to_gamma), + /* K3 */ be_nested_str(offset), + /* K4 */ be_nested_str(leds), }), &be_const_str_clear_to, &be_const_str_solidified, - ( &(const binstruction[14]) { /* code */ - 0x580C0000, // 0000 LDCONST R3 K0 - 0x88100101, // 0001 GETMBR R4 R0 K1 - 0x14100604, // 0002 LT R4 R3 R4 - 0x78120008, // 0003 JMPF R4 #000D - 0x88100102, // 0004 GETMBR R4 R0 K2 - 0x8C100903, // 0005 GETMET R4 R4 K3 - 0x88180104, // 0006 GETMBR R6 R0 K4 - 0x00180606, // 0007 ADD R6 R3 R6 - 0x5C1C0200, // 0008 MOVE R7 R1 - 0x5C200400, // 0009 MOVE R8 R2 - 0x7C100800, // 000A CALL R4 4 - 0x000C0705, // 000B ADD R3 R3 K5 - 0x7001FFF3, // 000C JMP #0001 - 0x80000000, // 000D RET 0 + ( &(const binstruction[12]) { /* code */ + 0x880C0100, // 0000 GETMBR R3 R0 K0 + 0x8C0C0701, // 0001 GETMET R3 R3 K1 + 0x54160008, // 0002 LDINT R5 9 + 0x88180100, // 0003 GETMBR R6 R0 K0 + 0x8C180D02, // 0004 GETMET R6 R6 K2 + 0x5C200200, // 0005 MOVE R8 R1 + 0x5C240400, // 0006 MOVE R9 R2 + 0x7C180600, // 0007 CALL R6 3 + 0x881C0103, // 0008 GETMBR R7 R0 K3 + 0x88200104, // 0009 GETMBR R8 R0 K4 + 0x7C0C0A00, // 000A CALL R3 5 + 0x80000000, // 000B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_count +********************************************************************/ +be_local_closure(Leds_segment_pixel_count, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(leds), + }), + &be_const_str_pixel_count, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixels_buffer +********************************************************************/ +be_local_closure(Leds_segment_pixels_buffer, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + &be_const_str_pixels_buffer, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x4C040000, // 0000 LDNIL R1 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: dirty +********************************************************************/ +be_local_closure(Leds_segment_dirty, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(dirty), + }), + &be_const_str_dirty, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80000000, // 0003 RET 0 }) ) ); @@ -351,6 +253,36 @@ be_local_closure(Leds_segment_set_pixel_color, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: is_dirty +********************************************************************/ +be_local_closure(Leds_segment_is_dirty, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(is_dirty), + }), + &be_const_str_is_dirty, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified function: clear ********************************************************************/ @@ -409,39 +341,12 @@ be_local_closure(Leds_segment_begin, /* name */ /******************************************************************** -** Solidified function: pixel_count +** Solidified function: get_pixel_color ********************************************************************/ -be_local_closure(Leds_segment_pixel_count, /* name */ +be_local_closure(Leds_segment_get_pixel_color, /* name */ be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(leds), - }), - &be_const_str_pixel_count, - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Leds_segment_init, /* name */ - be_nested_proto( - 6, /* nstack */ - 4, /* argc */ + 5, /* nstack */ + 2, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ @@ -450,22 +355,18 @@ be_local_closure(Leds_segment_init, /* name */ 1, /* has constants */ ( &(const bvalue[ 3]) { /* constants */ /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(offset), - /* K2 */ be_nested_str(leds), + /* K1 */ be_nested_str(get_pixel_color), + /* K2 */ be_nested_str(offseta), }), - &be_const_str_init, + &be_const_str_get_pixel_color, &be_const_str_solidified, - ( &(const binstruction[10]) { /* code */ - 0x90020001, // 0000 SETMBR R0 K0 R1 - 0x60100009, // 0001 GETGBL R4 G9 - 0x5C140400, // 0002 MOVE R5 R2 - 0x7C100200, // 0003 CALL R4 1 - 0x90020204, // 0004 SETMBR R0 K1 R4 - 0x60100009, // 0005 GETGBL R4 G9 - 0x5C140600, // 0006 MOVE R5 R3 - 0x7C100200, // 0007 CALL R4 1 - 0x90020404, // 0008 SETMBR R0 K2 R4 - 0x80000000, // 0009 RET 0 + ( &(const binstruction[ 6]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x88100102, // 0002 GETMBR R4 R0 K2 + 0x00100204, // 0003 ADD R4 R1 R4 + 0x7C080400, // 0004 CALL R2 2 + 0x80040400, // 0005 RET 1 R2 }) ) ); @@ -503,29 +404,36 @@ be_local_closure(Leds_segment_pixel_size, /* name */ /******************************************************************** -** Solidified function: dirty +** Solidified function: init ********************************************************************/ -be_local_closure(Leds_segment_dirty, /* name */ +be_local_closure(Leds_segment_init, /* name */ be_nested_proto( - 3, /* nstack */ - 1, /* argc */ + 6, /* nstack */ + 4, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ + ( &(const bvalue[ 3]) { /* constants */ /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(dirty), + /* K1 */ be_nested_str(offset), + /* K2 */ be_nested_str(leds), }), - &be_const_str_dirty, + &be_const_str_init, &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x80000000, // 0003 RET 0 + ( &(const binstruction[10]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x60100009, // 0001 GETGBL R4 G9 + 0x5C140400, // 0002 MOVE R5 R2 + 0x7C100200, // 0003 CALL R4 1 + 0x90020204, // 0004 SETMBR R0 K1 R4 + 0x60100009, // 0005 GETGBL R4 G9 + 0x5C140600, // 0006 MOVE R5 R3 + 0x7C100200, // 0007 CALL R4 1 + 0x90020404, // 0008 SETMBR R0 K2 R4 + 0x80000000, // 0009 RET 0 }) ) ); @@ -577,85 +485,31 @@ be_local_closure(Leds_segment_show, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: is_dirty -********************************************************************/ -be_local_closure(Leds_segment_is_dirty, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(is_dirty), - }), - &be_const_str_is_dirty, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: pixels_buffer -********************************************************************/ -be_local_closure(Leds_segment_pixels_buffer, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 0, /* has constants */ - NULL, /* no const */ - &be_const_str_pixels_buffer, - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x4C040000, // 0000 LDNIL R1 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified class: Leds_segment ********************************************************************/ be_local_class(Leds_segment, 3, NULL, - be_nested_map(16, + be_nested_map(17, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(get_pixel_color, -1), be_const_closure(Leds_segment_get_pixel_color_closure) }, - { be_const_key(strip, -1), be_const_var(0) }, - { be_const_key(clear_to, 5), be_const_closure(Leds_segment_clear_to_closure) }, - { be_const_key(can_show, 13), be_const_closure(Leds_segment_can_show_closure) }, - { be_const_key(set_pixel_color, -1), be_const_closure(Leds_segment_set_pixel_color_closure) }, - { be_const_key(clear, -1), be_const_closure(Leds_segment_clear_closure) }, - { be_const_key(is_dirty, -1), be_const_closure(Leds_segment_is_dirty_closure) }, - { be_const_key(pixel_count, -1), be_const_closure(Leds_segment_pixel_count_closure) }, - { be_const_key(leds, -1), be_const_var(2) }, - { be_const_key(pixel_size, -1), be_const_closure(Leds_segment_pixel_size_closure) }, - { be_const_key(offset, -1), be_const_var(1) }, - { be_const_key(dirty, 8), be_const_closure(Leds_segment_dirty_closure) }, + { be_const_key(pixel_offset, 9), be_const_closure(Leds_segment_pixel_offset_closure) }, + { be_const_key(clear_to, -1), be_const_closure(Leds_segment_clear_to_closure) }, { be_const_key(show, -1), be_const_closure(Leds_segment_show_closure) }, + { be_const_key(pixels_buffer, 10), be_const_closure(Leds_segment_pixels_buffer_closure) }, + { be_const_key(offset, -1), be_const_var(1) }, + { be_const_key(dirty, -1), be_const_closure(Leds_segment_dirty_closure) }, + { be_const_key(can_show, -1), be_const_closure(Leds_segment_can_show_closure) }, + { be_const_key(set_pixel_color, 6), be_const_closure(Leds_segment_set_pixel_color_closure) }, + { be_const_key(get_pixel_color, -1), be_const_closure(Leds_segment_get_pixel_color_closure) }, + { be_const_key(pixel_count, -1), be_const_closure(Leds_segment_pixel_count_closure) }, + { be_const_key(strip, 7), be_const_var(0) }, + { be_const_key(leds, -1), be_const_var(2) }, + { be_const_key(begin, -1), be_const_closure(Leds_segment_begin_closure) }, + { be_const_key(is_dirty, 8), be_const_closure(Leds_segment_is_dirty_closure) }, + { be_const_key(pixel_size, -1), be_const_closure(Leds_segment_pixel_size_closure) }, { be_const_key(init, -1), be_const_closure(Leds_segment_init_closure) }, - { be_const_key(begin, 6), be_const_closure(Leds_segment_begin_closure) }, - { be_const_key(pixels_buffer, -1), be_const_closure(Leds_segment_pixels_buffer_closure) }, + { be_const_key(clear, 2), be_const_closure(Leds_segment_clear_closure) }, })), (bstring*) &be_const_str_Leds_segment ); @@ -712,918 +566,6 @@ be_local_closure(Leds_create_segment, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: is_dirty -********************************************************************/ -be_local_closure(Leds_is_dirty, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(call_native), - }), - &be_const_str_is_dirty, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x540E0003, // 0001 LDINT R3 4 - 0x7C040400, // 0002 CALL R1 2 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -extern const bclass be_class_Leds_matrix; - -/******************************************************************** -** Solidified function: pixels_buffer -********************************************************************/ -be_local_closure(Leds_matrix_pixels_buffer, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(pixels_buffer), - }), - &be_const_str_pixels_buffer, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Leds_matrix_init, /* name */ - be_nested_proto( - 7, /* nstack */ - 5, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 9]) { /* constants */ - /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(offset), - /* K2 */ be_nested_str(h), - /* K3 */ be_nested_str(w), - /* K4 */ be_nested_str(alternate), - /* K5 */ be_nested_str(pix_buffer), - /* K6 */ be_nested_str(pixels_buffer), - /* K7 */ be_nested_str(pix_size), - /* K8 */ be_nested_str(pixel_size), - }), - &be_const_str_init, - &be_const_str_solidified, - ( &(const binstruction[15]) { /* code */ - 0x90020001, // 0000 SETMBR R0 K0 R1 - 0x90020204, // 0001 SETMBR R0 K1 R4 - 0x90020403, // 0002 SETMBR R0 K2 R3 - 0x90020602, // 0003 SETMBR R0 K3 R2 - 0x50140000, // 0004 LDBOOL R5 0 0 - 0x90020805, // 0005 SETMBR R0 K4 R5 - 0x88140100, // 0006 GETMBR R5 R0 K0 - 0x8C140B06, // 0007 GETMET R5 R5 K6 - 0x7C140200, // 0008 CALL R5 1 - 0x90020A05, // 0009 SETMBR R0 K5 R5 - 0x88140100, // 000A GETMBR R5 R0 K0 - 0x8C140B08, // 000B GETMET R5 R5 K8 - 0x7C140200, // 000C CALL R5 1 - 0x90020E05, // 000D SETMBR R0 K7 R5 - 0x80000000, // 000E RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_pixel_color -********************************************************************/ -be_local_closure(Leds_matrix_set_pixel_color, /* name */ - be_nested_proto( - 9, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(set_pixel_color), - /* K2 */ be_nested_str(offset), - }), - &be_const_str_set_pixel_color, - &be_const_str_solidified, - ( &(const binstruction[ 8]) { /* code */ - 0x88100100, // 0000 GETMBR R4 R0 K0 - 0x8C100901, // 0001 GETMET R4 R4 K1 - 0x88180102, // 0002 GETMBR R6 R0 K2 - 0x00180206, // 0003 ADD R6 R1 R6 - 0x5C1C0400, // 0004 MOVE R7 R2 - 0x5C200600, // 0005 MOVE R8 R3 - 0x7C100800, // 0006 CALL R4 4 - 0x80000000, // 0007 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: begin -********************************************************************/ -be_local_closure(Leds_matrix_begin, /* name */ - be_nested_proto( - 1, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 0, /* has constants */ - NULL, /* no const */ - &be_const_str_begin, - &be_const_str_solidified, - ( &(const binstruction[ 1]) { /* code */ - 0x80000000, // 0000 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_pixel_color -********************************************************************/ -be_local_closure(Leds_matrix_get_pixel_color, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(get_pixel_color), - /* K2 */ be_nested_str(offseta), - }), - &be_const_str_get_pixel_color, - &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x88100102, // 0002 GETMBR R4 R0 K2 - 0x00100204, // 0003 ADD R4 R1 R4 - 0x7C080400, // 0004 CALL R2 2 - 0x80040400, // 0005 RET 1 R2 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: pixel_size -********************************************************************/ -be_local_closure(Leds_matrix_pixel_size, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(pix_size), - }), - &be_const_str_pixel_size, - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_alternate -********************************************************************/ -be_local_closure(Leds_matrix_set_alternate, /* name */ - be_nested_proto( - 2, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(alternate), - }), - &be_const_str_set_alternate, - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x90020001, // 0000 SETMBR R0 K0 R1 - 0x80000000, // 0001 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: can_show -********************************************************************/ -be_local_closure(Leds_matrix_can_show, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(can_show), - }), - &be_const_str_can_show, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: clear -********************************************************************/ -be_local_closure(Leds_matrix_clear, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(clear_to), - /* K1 */ be_const_int(0), - /* K2 */ be_nested_str(show), - }), - &be_const_str_clear, - &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x580C0001, // 0001 LDCONST R3 K1 - 0x7C040400, // 0002 CALL R1 2 - 0x8C040102, // 0003 GETMET R1 R0 K2 - 0x7C040200, // 0004 CALL R1 1 - 0x80000000, // 0005 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_matrix_pixel_color -********************************************************************/ -be_local_closure(Leds_matrix_set_matrix_pixel_color, /* name */ - be_nested_proto( - 10, /* nstack */ - 5, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 8]) { /* constants */ - /* K0 */ be_nested_str(alternate), - /* K1 */ be_const_int(2), - /* K2 */ be_nested_str(strip), - /* K3 */ be_nested_str(set_pixel_color), - /* K4 */ be_nested_str(w), - /* K5 */ be_nested_str(h), - /* K6 */ be_const_int(1), - /* K7 */ be_nested_str(offset), - }), - &be_const_str_set_matrix_pixel_color, - &be_const_str_solidified, - ( &(const binstruction[29]) { /* code */ - 0x88140100, // 0000 GETMBR R5 R0 K0 - 0x7816000F, // 0001 JMPF R5 #0012 - 0x10140301, // 0002 MOD R5 R1 K1 - 0x7816000D, // 0003 JMPF R5 #0012 - 0x88140102, // 0004 GETMBR R5 R0 K2 - 0x8C140B03, // 0005 GETMET R5 R5 K3 - 0x881C0104, // 0006 GETMBR R7 R0 K4 - 0x081C0207, // 0007 MUL R7 R1 R7 - 0x88200105, // 0008 GETMBR R8 R0 K5 - 0x001C0E08, // 0009 ADD R7 R7 R8 - 0x041C0E02, // 000A SUB R7 R7 R2 - 0x041C0F06, // 000B SUB R7 R7 K6 - 0x88200107, // 000C GETMBR R8 R0 K7 - 0x001C0E08, // 000D ADD R7 R7 R8 - 0x5C200600, // 000E MOVE R8 R3 - 0x5C240800, // 000F MOVE R9 R4 - 0x7C140800, // 0010 CALL R5 4 - 0x70020009, // 0011 JMP #001C - 0x88140102, // 0012 GETMBR R5 R0 K2 - 0x8C140B03, // 0013 GETMET R5 R5 K3 - 0x881C0104, // 0014 GETMBR R7 R0 K4 - 0x081C0207, // 0015 MUL R7 R1 R7 - 0x001C0E02, // 0016 ADD R7 R7 R2 - 0x88200107, // 0017 GETMBR R8 R0 K7 - 0x001C0E08, // 0018 ADD R7 R7 R8 - 0x5C200600, // 0019 MOVE R8 R3 - 0x5C240800, // 001A MOVE R9 R4 - 0x7C140800, // 001B CALL R5 4 - 0x80000000, // 001C RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: pixel_count -********************************************************************/ -be_local_closure(Leds_matrix_pixel_count, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(w), - /* K1 */ be_nested_str(h), - }), - &be_const_str_pixel_count, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x88080101, // 0001 GETMBR R2 R0 K1 - 0x08040202, // 0002 MUL R1 R1 R2 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: show -********************************************************************/ -be_local_closure(Leds_matrix_show, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 9]) { /* constants */ - /* K0 */ be_nested_str(offset), - /* K1 */ be_const_int(0), - /* K2 */ be_nested_str(w), - /* K3 */ be_nested_str(h), - /* K4 */ be_nested_str(strip), - /* K5 */ be_nested_str(leds), - /* K6 */ be_nested_str(show), - /* K7 */ be_nested_str(pix_buffer), - /* K8 */ be_nested_str(pixels_buffer), - }), - &be_const_str_show, - &be_const_str_solidified, - ( &(const binstruction[23]) { /* code */ - 0x60080017, // 0000 GETGBL R2 G23 - 0x5C0C0200, // 0001 MOVE R3 R1 - 0x7C080200, // 0002 CALL R2 1 - 0x740A0009, // 0003 JMPT R2 #000E - 0x88080100, // 0004 GETMBR R2 R0 K0 - 0x1C080501, // 0005 EQ R2 R2 K1 - 0x780A000E, // 0006 JMPF R2 #0016 - 0x88080102, // 0007 GETMBR R2 R0 K2 - 0x880C0103, // 0008 GETMBR R3 R0 K3 - 0x08080403, // 0009 MUL R2 R2 R3 - 0x880C0104, // 000A GETMBR R3 R0 K4 - 0x880C0705, // 000B GETMBR R3 R3 K5 - 0x1C080403, // 000C EQ R2 R2 R3 - 0x780A0007, // 000D JMPF R2 #0016 - 0x88080104, // 000E GETMBR R2 R0 K4 - 0x8C080506, // 000F GETMET R2 R2 K6 - 0x7C080200, // 0010 CALL R2 1 - 0x88080104, // 0011 GETMBR R2 R0 K4 - 0x8C080508, // 0012 GETMET R2 R2 K8 - 0x88100107, // 0013 GETMBR R4 R0 K7 - 0x7C080400, // 0014 CALL R2 2 - 0x90020E02, // 0015 SETMBR R0 K7 R2 - 0x80000000, // 0016 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: clear_to -********************************************************************/ -be_local_closure(Leds_matrix_clear_to, /* name */ - be_nested_proto( - 9, /* nstack */ - 3, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 7]) { /* constants */ - /* K0 */ be_const_int(0), - /* K1 */ be_nested_str(w), - /* K2 */ be_nested_str(h), - /* K3 */ be_nested_str(strip), - /* K4 */ be_nested_str(set_pixel_color), - /* K5 */ be_nested_str(offset), - /* K6 */ be_const_int(1), - }), - &be_const_str_clear_to, - &be_const_str_solidified, - ( &(const binstruction[16]) { /* code */ - 0x580C0000, // 0000 LDCONST R3 K0 - 0x88100101, // 0001 GETMBR R4 R0 K1 - 0x88140102, // 0002 GETMBR R5 R0 K2 - 0x08100805, // 0003 MUL R4 R4 R5 - 0x14100604, // 0004 LT R4 R3 R4 - 0x78120008, // 0005 JMPF R4 #000F - 0x88100103, // 0006 GETMBR R4 R0 K3 - 0x8C100904, // 0007 GETMET R4 R4 K4 - 0x88180105, // 0008 GETMBR R6 R0 K5 - 0x00180606, // 0009 ADD R6 R3 R6 - 0x5C1C0200, // 000A MOVE R7 R1 - 0x5C200400, // 000B MOVE R8 R2 - 0x7C100800, // 000C CALL R4 4 - 0x000C0706, // 000D ADD R3 R3 K6 - 0x7001FFF1, // 000E JMP #0001 - 0x80000000, // 000F RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: dirty -********************************************************************/ -be_local_closure(Leds_matrix_dirty, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(dirty), - }), - &be_const_str_dirty, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x80000000, // 0003 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_alternate -********************************************************************/ -be_local_closure(Leds_matrix_get_alternate, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(alternate), - }), - &be_const_str_get_alternate, - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: is_dirty -********************************************************************/ -be_local_closure(Leds_matrix_is_dirty, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(is_dirty), - }), - &be_const_str_is_dirty, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_bytes -********************************************************************/ -be_local_closure(Leds_matrix_set_bytes, /* name */ - be_nested_proto( - 13, /* nstack */ - 5, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str(h), - /* K1 */ be_nested_str(pix_size), - /* K2 */ be_nested_str(offset), - /* K3 */ be_nested_str(pix_buffer), - /* K4 */ be_nested_str(setbytes), - }), - &be_const_str_set_bytes, - &be_const_str_solidified, - ( &(const binstruction[17]) { /* code */ - 0x88140100, // 0000 GETMBR R5 R0 K0 - 0x88180101, // 0001 GETMBR R6 R0 K1 - 0x08140A06, // 0002 MUL R5 R5 R6 - 0x24180805, // 0003 GT R6 R4 R5 - 0x781A0000, // 0004 JMPF R6 #0006 - 0x5C100A00, // 0005 MOVE R4 R5 - 0x88180102, // 0006 GETMBR R6 R0 K2 - 0x00180C01, // 0007 ADD R6 R6 R1 - 0x08180C05, // 0008 MUL R6 R6 R5 - 0x881C0103, // 0009 GETMBR R7 R0 K3 - 0x8C1C0F04, // 000A GETMET R7 R7 K4 - 0x5C240C00, // 000B MOVE R9 R6 - 0x5C280400, // 000C MOVE R10 R2 - 0x5C2C0600, // 000D MOVE R11 R3 - 0x5C300800, // 000E MOVE R12 R4 - 0x7C1C0A00, // 000F CALL R7 5 - 0x80000000, // 0010 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified class: Leds_matrix -********************************************************************/ -be_local_class(Leds_matrix, - 7, - NULL, - be_nested_map(24, - ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(set_bytes, -1), be_const_closure(Leds_matrix_set_bytes_closure) }, - { be_const_key(pix_buffer, -1), be_const_var(5) }, - { be_const_key(pix_size, 20), be_const_var(6) }, - { be_const_key(init, -1), be_const_closure(Leds_matrix_init_closure) }, - { be_const_key(set_pixel_color, 16), be_const_closure(Leds_matrix_set_pixel_color_closure) }, - { be_const_key(alternate, -1), be_const_var(4) }, - { be_const_key(begin, -1), be_const_closure(Leds_matrix_begin_closure) }, - { be_const_key(h, -1), be_const_var(2) }, - { be_const_key(get_pixel_color, -1), be_const_closure(Leds_matrix_get_pixel_color_closure) }, - { be_const_key(pixel_size, 21), be_const_closure(Leds_matrix_pixel_size_closure) }, - { be_const_key(set_alternate, -1), be_const_closure(Leds_matrix_set_alternate_closure) }, - { be_const_key(can_show, -1), be_const_closure(Leds_matrix_can_show_closure) }, - { be_const_key(get_alternate, 13), be_const_closure(Leds_matrix_get_alternate_closure) }, - { be_const_key(w, -1), be_const_var(3) }, - { be_const_key(set_matrix_pixel_color, 12), be_const_closure(Leds_matrix_set_matrix_pixel_color_closure) }, - { be_const_key(pixel_count, -1), be_const_closure(Leds_matrix_pixel_count_closure) }, - { be_const_key(show, -1), be_const_closure(Leds_matrix_show_closure) }, - { be_const_key(offset, -1), be_const_var(1) }, - { be_const_key(clear_to, 17), be_const_closure(Leds_matrix_clear_to_closure) }, - { be_const_key(dirty, -1), be_const_closure(Leds_matrix_dirty_closure) }, - { be_const_key(clear, 10), be_const_closure(Leds_matrix_clear_closure) }, - { be_const_key(strip, -1), be_const_var(0) }, - { be_const_key(is_dirty, -1), be_const_closure(Leds_matrix_is_dirty_closure) }, - { be_const_key(pixels_buffer, 0), be_const_closure(Leds_matrix_pixels_buffer_closure) }, - })), - (bstring*) &be_const_str_Leds_matrix -); - -/******************************************************************** -** Solidified function: create_matrix -********************************************************************/ -be_local_closure(Leds_create_matrix, /* name */ - be_nested_proto( - 10, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_const_int(0), - /* K1 */ be_nested_str(leds), - /* K2 */ be_nested_str(value_error), - /* K3 */ be_nested_str(out_X20of_X20range), - /* K4 */ be_const_class(be_class_Leds_matrix), - }), - &be_const_str_create_matrix, - &be_const_str_solidified, - ( &(const binstruction[37]) { /* code */ - 0x60100009, // 0000 GETGBL R4 G9 - 0x5C140600, // 0001 MOVE R5 R3 - 0x7C100200, // 0002 CALL R4 1 - 0x5C0C0800, // 0003 MOVE R3 R4 - 0x60100009, // 0004 GETGBL R4 G9 - 0x5C140200, // 0005 MOVE R5 R1 - 0x7C100200, // 0006 CALL R4 1 - 0x5C040800, // 0007 MOVE R1 R4 - 0x60100009, // 0008 GETGBL R4 G9 - 0x5C140400, // 0009 MOVE R5 R2 - 0x7C100200, // 000A CALL R4 1 - 0x5C080800, // 000B MOVE R2 R4 - 0x4C100000, // 000C LDNIL R4 - 0x1C100604, // 000D EQ R4 R3 R4 - 0x78120000, // 000E JMPF R4 #0010 - 0x580C0000, // 000F LDCONST R3 K0 - 0x08100202, // 0010 MUL R4 R1 R2 - 0x00100803, // 0011 ADD R4 R4 R3 - 0x88140101, // 0012 GETMBR R5 R0 K1 - 0x24100805, // 0013 GT R4 R4 R5 - 0x74120005, // 0014 JMPT R4 #001B - 0x14100500, // 0015 LT R4 R2 K0 - 0x74120003, // 0016 JMPT R4 #001B - 0x14100300, // 0017 LT R4 R1 K0 - 0x74120001, // 0018 JMPT R4 #001B - 0x14100700, // 0019 LT R4 R3 K0 - 0x78120000, // 001A JMPF R4 #001C - 0xB0060503, // 001B RAISE 1 K2 K3 - 0x58100004, // 001C LDCONST R4 K4 - 0xB4000004, // 001D CLASS K4 - 0x5C140800, // 001E MOVE R5 R4 - 0x5C180000, // 001F MOVE R6 R0 - 0x5C1C0200, // 0020 MOVE R7 R1 - 0x5C200400, // 0021 MOVE R8 R2 - 0x5C240600, // 0022 MOVE R9 R3 - 0x7C140800, // 0023 CALL R5 4 - 0x80040A00, // 0024 RET 1 R5 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: pixels_buffer -********************************************************************/ -be_local_closure(Leds_pixels_buffer, /* name */ - be_nested_proto( - 8, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str(call_native), - /* K1 */ be_nested_str(pixel_size), - /* K2 */ be_nested_str(pixel_count), - /* K3 */ be_nested_str(_change_buffer), - }), - &be_const_str_pixels_buffer, - &be_const_str_solidified, - ( &(const binstruction[21]) { /* code */ - 0x8C080100, // 0000 GETMET R2 R0 K0 - 0x54120005, // 0001 LDINT R4 6 - 0x7C080400, // 0002 CALL R2 2 - 0x4C0C0000, // 0003 LDNIL R3 - 0x1C0C0203, // 0004 EQ R3 R1 R3 - 0x780E0009, // 0005 JMPF R3 #0010 - 0x600C0015, // 0006 GETGBL R3 G21 - 0x5C100400, // 0007 MOVE R4 R2 - 0x8C140101, // 0008 GETMET R5 R0 K1 - 0x7C140200, // 0009 CALL R5 1 - 0x8C180102, // 000A GETMET R6 R0 K2 - 0x7C180200, // 000B CALL R6 1 - 0x08140A06, // 000C MUL R5 R5 R6 - 0x7C0C0400, // 000D CALL R3 2 - 0x80040600, // 000E RET 1 R3 - 0x70020003, // 000F JMP #0014 - 0x8C0C0303, // 0010 GETMET R3 R1 K3 - 0x5C140400, // 0011 MOVE R5 R2 - 0x7C0C0400, // 0012 CALL R3 2 - 0x80040200, // 0013 RET 1 R1 - 0x80000000, // 0014 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Leds_init, /* name */ - be_nested_proto( - 11, /* nstack */ - 5, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 9]) { /* constants */ - /* K0 */ be_nested_str(gamma), - /* K1 */ be_nested_str(leds), - /* K2 */ be_nested_str(valuer_error), - /* K3 */ be_nested_str(no_X20GPIO_X20specified_X20for_X20neopixelbus), - /* K4 */ be_nested_str(ctor), - /* K5 */ be_nested_str(_p), - /* K6 */ be_nested_str(internal_error), - /* K7 */ be_nested_str(couldn_X27t_X20not_X20initialize_X20noepixelbus), - /* K8 */ be_nested_str(begin), - }), - &be_const_str_init, - &be_const_str_solidified, - ( &(const binstruction[24]) { /* code */ - 0x50140200, // 0000 LDBOOL R5 1 0 - 0x90020005, // 0001 SETMBR R0 K0 R5 - 0x60140009, // 0002 GETGBL R5 G9 - 0x5C180200, // 0003 MOVE R6 R1 - 0x7C140200, // 0004 CALL R5 1 - 0x90020205, // 0005 SETMBR R0 K1 R5 - 0x4C140000, // 0006 LDNIL R5 - 0x1C140405, // 0007 EQ R5 R2 R5 - 0x78160000, // 0008 JMPF R5 #000A - 0xB0060503, // 0009 RAISE 1 K2 K3 - 0x8C140104, // 000A GETMET R5 R0 K4 - 0x881C0101, // 000B GETMBR R7 R0 K1 - 0x5C200400, // 000C MOVE R8 R2 - 0x5C240600, // 000D MOVE R9 R3 - 0x5C280800, // 000E MOVE R10 R4 - 0x7C140A00, // 000F CALL R5 5 - 0x88140105, // 0010 GETMBR R5 R0 K5 - 0x4C180000, // 0011 LDNIL R6 - 0x1C140A06, // 0012 EQ R5 R5 R6 - 0x78160000, // 0013 JMPF R5 #0015 - 0xB0060D07, // 0014 RAISE 1 K6 K7 - 0x8C140108, // 0015 GETMET R5 R0 K8 - 0x7C140200, // 0016 CALL R5 1 - 0x80000000, // 0017 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: dirty -********************************************************************/ -be_local_closure(Leds_dirty, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(call_native), - }), - &be_const_str_dirty, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x540E0004, // 0001 LDINT R3 5 - 0x7C040400, // 0002 CALL R1 2 - 0x80000000, // 0003 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_pixel_color -********************************************************************/ -be_local_closure(Leds_get_pixel_color, /* name */ - be_nested_proto( - 6, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(call_native), - }), - &be_const_str_get_pixel_color, - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x8C080100, // 0000 GETMET R2 R0 K0 - 0x5412000A, // 0001 LDINT R4 11 - 0x5C140200, // 0002 MOVE R5 R1 - 0x7C080600, // 0003 CALL R2 3 - 0x80040400, // 0004 RET 1 R2 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified function: assign_rmt ********************************************************************/ @@ -1738,9 +680,79 @@ be_local_closure(Leds_assign_rmt, /* name */ /******************************************************************** -** Solidified function: pixel_size +** Solidified function: can_show ********************************************************************/ -be_local_closure(Leds_pixel_size, /* name */ +be_local_closure(Leds_can_show, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(call_native), + /* K1 */ be_const_int(3), + }), + &be_const_str_can_show, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x580C0001, // 0001 LDCONST R3 K1 + 0x7C040400, // 0002 CALL R1 2 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: matrix +********************************************************************/ +be_local_closure(Leds_matrix, /* name */ + be_nested_proto( + 11, /* nstack */ + 4, /* argc */ + 4, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_const_class(be_class_Leds), + /* K1 */ be_nested_str(Leds), + /* K2 */ be_nested_str(create_matrix), + /* K3 */ be_const_int(0), + }), + &be_const_str_matrix, + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0x58100000, // 0000 LDCONST R4 K0 + 0xB8160200, // 0001 GETNGBL R5 K1 + 0x08180001, // 0002 MUL R6 R0 R1 + 0x5C1C0400, // 0003 MOVE R7 R2 + 0x5C200600, // 0004 MOVE R8 R3 + 0x7C140600, // 0005 CALL R5 3 + 0x8C180B02, // 0006 GETMET R6 R5 K2 + 0x5C200000, // 0007 MOVE R8 R0 + 0x5C240200, // 0008 MOVE R9 R1 + 0x58280003, // 0009 LDCONST R10 K3 + 0x7C180800, // 000A CALL R6 4 + 0x80040C00, // 000B RET 1 R6 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_count +********************************************************************/ +be_local_closure(Leds_pixel_count, /* name */ be_nested_proto( 4, /* nstack */ 1, /* argc */ @@ -1753,11 +765,11 @@ be_local_closure(Leds_pixel_size, /* name */ ( &(const bvalue[ 1]) { /* constants */ /* K0 */ be_nested_str(call_native), }), - &be_const_str_pixel_size, + &be_const_str_pixel_count, &be_const_str_solidified, ( &(const binstruction[ 4]) { /* code */ 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x540E0006, // 0001 LDINT R3 7 + 0x540E0007, // 0001 LDINT R3 8 0x7C040400, // 0002 CALL R1 2 0x80040200, // 0003 RET 1 R1 }) @@ -1766,12 +778,868 @@ be_local_closure(Leds_pixel_size, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: is_dirty +********************************************************************/ +be_local_closure(Leds_is_dirty, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(call_native), + }), + &be_const_str_is_dirty, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0003, // 0001 LDINT R3 4 + 0x7C040400, // 0002 CALL R1 2 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixels_buffer +********************************************************************/ +be_local_closure(Leds_pixels_buffer, /* name */ + be_nested_proto( + 8, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str(call_native), + /* K1 */ be_nested_str(pixel_size), + /* K2 */ be_nested_str(pixel_count), + /* K3 */ be_nested_str(_change_buffer), + }), + &be_const_str_pixels_buffer, + &be_const_str_solidified, + ( &(const binstruction[21]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x54120005, // 0001 LDINT R4 6 + 0x7C080400, // 0002 CALL R2 2 + 0x4C0C0000, // 0003 LDNIL R3 + 0x1C0C0203, // 0004 EQ R3 R1 R3 + 0x780E0009, // 0005 JMPF R3 #0010 + 0x600C0015, // 0006 GETGBL R3 G21 + 0x5C100400, // 0007 MOVE R4 R2 + 0x8C140101, // 0008 GETMET R5 R0 K1 + 0x7C140200, // 0009 CALL R5 1 + 0x8C180102, // 000A GETMET R6 R0 K2 + 0x7C180200, // 000B CALL R6 1 + 0x08140A06, // 000C MUL R5 R5 R6 + 0x7C0C0400, // 000D CALL R3 2 + 0x80040600, // 000E RET 1 R3 + 0x70020003, // 000F JMP #0014 + 0x8C0C0303, // 0010 GETMET R3 R1 K3 + 0x5C140400, // 0011 MOVE R5 R2 + 0x7C0C0400, // 0012 CALL R3 2 + 0x80040200, // 0013 RET 1 R1 + 0x80000000, // 0014 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_pixel_color +********************************************************************/ +be_local_closure(Leds_set_pixel_color, /* name */ + be_nested_proto( + 12, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(call_native), + /* K1 */ be_nested_str(to_gamma), + }), + &be_const_str_set_pixel_color, + &be_const_str_solidified, + ( &(const binstruction[ 9]) { /* code */ + 0x8C100100, // 0000 GETMET R4 R0 K0 + 0x541A0009, // 0001 LDINT R6 10 + 0x5C1C0200, // 0002 MOVE R7 R1 + 0x8C200101, // 0003 GETMET R8 R0 K1 + 0x5C280400, // 0004 MOVE R10 R2 + 0x5C2C0600, // 0005 MOVE R11 R3 + 0x7C200600, // 0006 CALL R8 3 + 0x7C100800, // 0007 CALL R4 4 + 0x80000000, // 0008 RET 0 + }) + ) +); +/*******************************************************************/ + + +extern const bclass be_class_Leds_matrix; + +/******************************************************************** +** Solidified function: clear_to +********************************************************************/ +be_local_closure(Leds_matrix_clear_to, /* name */ + be_nested_proto( + 10, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(call_native), + /* K2 */ be_nested_str(to_gamma), + /* K3 */ be_nested_str(offset), + /* K4 */ be_nested_str(w), + /* K5 */ be_nested_str(h), + }), + &be_const_str_clear_to, + &be_const_str_solidified, + ( &(const binstruction[14]) { /* code */ + 0x880C0100, // 0000 GETMBR R3 R0 K0 + 0x8C0C0701, // 0001 GETMET R3 R3 K1 + 0x54160008, // 0002 LDINT R5 9 + 0x88180100, // 0003 GETMBR R6 R0 K0 + 0x8C180D02, // 0004 GETMET R6 R6 K2 + 0x5C200200, // 0005 MOVE R8 R1 + 0x5C240400, // 0006 MOVE R9 R2 + 0x7C180600, // 0007 CALL R6 3 + 0x881C0103, // 0008 GETMBR R7 R0 K3 + 0x88200104, // 0009 GETMBR R8 R0 K4 + 0x88240105, // 000A GETMBR R9 R0 K5 + 0x08201009, // 000B MUL R8 R8 R9 + 0x7C0C0A00, // 000C CALL R3 5 + 0x80000000, // 000D RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: show +********************************************************************/ +be_local_closure(Leds_matrix_show, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str(offset), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(w), + /* K3 */ be_nested_str(h), + /* K4 */ be_nested_str(strip), + /* K5 */ be_nested_str(leds), + /* K6 */ be_nested_str(show), + /* K7 */ be_nested_str(pix_buffer), + /* K8 */ be_nested_str(pixels_buffer), + }), + &be_const_str_show, + &be_const_str_solidified, + ( &(const binstruction[23]) { /* code */ + 0x60080017, // 0000 GETGBL R2 G23 + 0x5C0C0200, // 0001 MOVE R3 R1 + 0x7C080200, // 0002 CALL R2 1 + 0x740A0009, // 0003 JMPT R2 #000E + 0x88080100, // 0004 GETMBR R2 R0 K0 + 0x1C080501, // 0005 EQ R2 R2 K1 + 0x780A000E, // 0006 JMPF R2 #0016 + 0x88080102, // 0007 GETMBR R2 R0 K2 + 0x880C0103, // 0008 GETMBR R3 R0 K3 + 0x08080403, // 0009 MUL R2 R2 R3 + 0x880C0104, // 000A GETMBR R3 R0 K4 + 0x880C0705, // 000B GETMBR R3 R3 K5 + 0x1C080403, // 000C EQ R2 R2 R3 + 0x780A0007, // 000D JMPF R2 #0016 + 0x88080104, // 000E GETMBR R2 R0 K4 + 0x8C080506, // 000F GETMET R2 R2 K6 + 0x7C080200, // 0010 CALL R2 1 + 0x88080104, // 0011 GETMBR R2 R0 K4 + 0x8C080508, // 0012 GETMET R2 R2 K8 + 0x88100107, // 0013 GETMBR R4 R0 K7 + 0x7C080400, // 0014 CALL R2 2 + 0x90020E02, // 0015 SETMBR R0 K7 R2 + 0x80000000, // 0016 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_size +********************************************************************/ +be_local_closure(Leds_matrix_pixel_size, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(pix_size), + }), + &be_const_str_pixel_size, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Leds_matrix_init, /* name */ + be_nested_proto( + 7, /* nstack */ + 5, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(offset), + /* K2 */ be_nested_str(h), + /* K3 */ be_nested_str(w), + /* K4 */ be_nested_str(alternate), + /* K5 */ be_nested_str(pix_buffer), + /* K6 */ be_nested_str(pixels_buffer), + /* K7 */ be_nested_str(pix_size), + /* K8 */ be_nested_str(pixel_size), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[15]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x90020204, // 0001 SETMBR R0 K1 R4 + 0x90020403, // 0002 SETMBR R0 K2 R3 + 0x90020602, // 0003 SETMBR R0 K3 R2 + 0x50140000, // 0004 LDBOOL R5 0 0 + 0x90020805, // 0005 SETMBR R0 K4 R5 + 0x88140100, // 0006 GETMBR R5 R0 K0 + 0x8C140B06, // 0007 GETMET R5 R5 K6 + 0x7C140200, // 0008 CALL R5 1 + 0x90020A05, // 0009 SETMBR R0 K5 R5 + 0x88140100, // 000A GETMBR R5 R0 K0 + 0x8C140B08, // 000B GETMET R5 R5 K8 + 0x7C140200, // 000C CALL R5 1 + 0x90020E05, // 000D SETMBR R0 K7 R5 + 0x80000000, // 000E RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_pixel_color +********************************************************************/ +be_local_closure(Leds_matrix_set_pixel_color, /* name */ + be_nested_proto( + 9, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(set_pixel_color), + /* K2 */ be_nested_str(offset), + }), + &be_const_str_set_pixel_color, + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x88100100, // 0000 GETMBR R4 R0 K0 + 0x8C100901, // 0001 GETMET R4 R4 K1 + 0x88180102, // 0002 GETMBR R6 R0 K2 + 0x00180206, // 0003 ADD R6 R1 R6 + 0x5C1C0400, // 0004 MOVE R7 R2 + 0x5C200600, // 0005 MOVE R8 R3 + 0x7C100800, // 0006 CALL R4 4 + 0x80000000, // 0007 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixels_buffer +********************************************************************/ +be_local_closure(Leds_matrix_pixels_buffer, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(pixels_buffer), + }), + &be_const_str_pixels_buffer, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: dirty +********************************************************************/ +be_local_closure(Leds_matrix_dirty, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(dirty), + }), + &be_const_str_dirty, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_matrix_pixel_color +********************************************************************/ +be_local_closure(Leds_matrix_set_matrix_pixel_color, /* name */ + be_nested_proto( + 10, /* nstack */ + 5, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str(alternate), + /* K1 */ be_const_int(2), + /* K2 */ be_nested_str(strip), + /* K3 */ be_nested_str(set_pixel_color), + /* K4 */ be_nested_str(w), + /* K5 */ be_nested_str(h), + /* K6 */ be_const_int(1), + /* K7 */ be_nested_str(offset), + }), + &be_const_str_set_matrix_pixel_color, + &be_const_str_solidified, + ( &(const binstruction[29]) { /* code */ + 0x88140100, // 0000 GETMBR R5 R0 K0 + 0x7816000F, // 0001 JMPF R5 #0012 + 0x10140301, // 0002 MOD R5 R1 K1 + 0x7816000D, // 0003 JMPF R5 #0012 + 0x88140102, // 0004 GETMBR R5 R0 K2 + 0x8C140B03, // 0005 GETMET R5 R5 K3 + 0x881C0104, // 0006 GETMBR R7 R0 K4 + 0x081C0207, // 0007 MUL R7 R1 R7 + 0x88200105, // 0008 GETMBR R8 R0 K5 + 0x001C0E08, // 0009 ADD R7 R7 R8 + 0x041C0E02, // 000A SUB R7 R7 R2 + 0x041C0F06, // 000B SUB R7 R7 K6 + 0x88200107, // 000C GETMBR R8 R0 K7 + 0x001C0E08, // 000D ADD R7 R7 R8 + 0x5C200600, // 000E MOVE R8 R3 + 0x5C240800, // 000F MOVE R9 R4 + 0x7C140800, // 0010 CALL R5 4 + 0x70020009, // 0011 JMP #001C + 0x88140102, // 0012 GETMBR R5 R0 K2 + 0x8C140B03, // 0013 GETMET R5 R5 K3 + 0x881C0104, // 0014 GETMBR R7 R0 K4 + 0x081C0207, // 0015 MUL R7 R1 R7 + 0x001C0E02, // 0016 ADD R7 R7 R2 + 0x88200107, // 0017 GETMBR R8 R0 K7 + 0x001C0E08, // 0018 ADD R7 R7 R8 + 0x5C200600, // 0019 MOVE R8 R3 + 0x5C240800, // 001A MOVE R9 R4 + 0x7C140800, // 001B CALL R5 4 + 0x80000000, // 001C RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: is_dirty +********************************************************************/ +be_local_closure(Leds_matrix_is_dirty, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(is_dirty), + }), + &be_const_str_is_dirty, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_alternate +********************************************************************/ +be_local_closure(Leds_matrix_set_alternate, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(alternate), + }), + &be_const_str_set_alternate, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: begin +********************************************************************/ +be_local_closure(Leds_matrix_begin, /* name */ + be_nested_proto( + 1, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + &be_const_str_begin, + &be_const_str_solidified, + ( &(const binstruction[ 1]) { /* code */ + 0x80000000, // 0000 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_count +********************************************************************/ +be_local_closure(Leds_matrix_pixel_count, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(w), + /* K1 */ be_nested_str(h), + }), + &be_const_str_pixel_count, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x88080101, // 0001 GETMBR R2 R0 K1 + 0x08040202, // 0002 MUL R1 R1 R2 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_alternate +********************************************************************/ +be_local_closure(Leds_matrix_get_alternate, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(alternate), + }), + &be_const_str_get_alternate, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_offset +********************************************************************/ +be_local_closure(Leds_matrix_pixel_offset, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(offset), + }), + &be_const_str_pixel_offset, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: can_show +********************************************************************/ +be_local_closure(Leds_matrix_can_show, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(can_show), + }), + &be_const_str_can_show, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_bytes +********************************************************************/ +be_local_closure(Leds_matrix_set_bytes, /* name */ + be_nested_proto( + 13, /* nstack */ + 5, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(h), + /* K1 */ be_nested_str(pix_size), + /* K2 */ be_nested_str(offset), + /* K3 */ be_nested_str(pix_buffer), + /* K4 */ be_nested_str(setbytes), + }), + &be_const_str_set_bytes, + &be_const_str_solidified, + ( &(const binstruction[17]) { /* code */ + 0x88140100, // 0000 GETMBR R5 R0 K0 + 0x88180101, // 0001 GETMBR R6 R0 K1 + 0x08140A06, // 0002 MUL R5 R5 R6 + 0x24180805, // 0003 GT R6 R4 R5 + 0x781A0000, // 0004 JMPF R6 #0006 + 0x5C100A00, // 0005 MOVE R4 R5 + 0x88180102, // 0006 GETMBR R6 R0 K2 + 0x00180C01, // 0007 ADD R6 R6 R1 + 0x08180C05, // 0008 MUL R6 R6 R5 + 0x881C0103, // 0009 GETMBR R7 R0 K3 + 0x8C1C0F04, // 000A GETMET R7 R7 K4 + 0x5C240C00, // 000B MOVE R9 R6 + 0x5C280400, // 000C MOVE R10 R2 + 0x5C2C0600, // 000D MOVE R11 R3 + 0x5C300800, // 000E MOVE R12 R4 + 0x7C1C0A00, // 000F CALL R7 5 + 0x80000000, // 0010 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_pixel_color +********************************************************************/ +be_local_closure(Leds_matrix_get_pixel_color, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(get_pixel_color), + /* K2 */ be_nested_str(offseta), + }), + &be_const_str_get_pixel_color, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x88100102, // 0002 GETMBR R4 R0 K2 + 0x00100204, // 0003 ADD R4 R1 R4 + 0x7C080400, // 0004 CALL R2 2 + 0x80040400, // 0005 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: clear +********************************************************************/ +be_local_closure(Leds_matrix_clear, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(clear_to), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(show), + }), + &be_const_str_clear, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x580C0001, // 0001 LDCONST R3 K1 + 0x7C040400, // 0002 CALL R1 2 + 0x8C040102, // 0003 GETMET R1 R0 K2 + 0x7C040200, // 0004 CALL R1 1 + 0x80000000, // 0005 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Leds_matrix +********************************************************************/ +be_local_class(Leds_matrix, + 7, + NULL, + be_nested_map(25, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(init, -1), be_const_closure(Leds_matrix_init_closure) }, + { be_const_key(show, -1), be_const_closure(Leds_matrix_show_closure) }, + { be_const_key(alternate, -1), be_const_var(4) }, + { be_const_key(get_pixel_color, 14), be_const_closure(Leds_matrix_get_pixel_color_closure) }, + { be_const_key(is_dirty, -1), be_const_closure(Leds_matrix_is_dirty_closure) }, + { be_const_key(clear_to, 0), be_const_closure(Leds_matrix_clear_to_closure) }, + { be_const_key(set_pixel_color, -1), be_const_closure(Leds_matrix_set_pixel_color_closure) }, + { be_const_key(pixels_buffer, -1), be_const_closure(Leds_matrix_pixels_buffer_closure) }, + { be_const_key(dirty, -1), be_const_closure(Leds_matrix_dirty_closure) }, + { be_const_key(can_show, 21), be_const_closure(Leds_matrix_can_show_closure) }, + { be_const_key(pixel_size, 4), be_const_closure(Leds_matrix_pixel_size_closure) }, + { be_const_key(w, -1), be_const_var(3) }, + { be_const_key(set_matrix_pixel_color, 9), be_const_closure(Leds_matrix_set_matrix_pixel_color_closure) }, + { be_const_key(offset, -1), be_const_var(1) }, + { be_const_key(strip, -1), be_const_var(0) }, + { be_const_key(begin, -1), be_const_closure(Leds_matrix_begin_closure) }, + { be_const_key(h, -1), be_const_var(2) }, + { be_const_key(pix_size, -1), be_const_var(6) }, + { be_const_key(pixel_count, -1), be_const_closure(Leds_matrix_pixel_count_closure) }, + { be_const_key(get_alternate, -1), be_const_closure(Leds_matrix_get_alternate_closure) }, + { be_const_key(pixel_offset, -1), be_const_closure(Leds_matrix_pixel_offset_closure) }, + { be_const_key(set_alternate, -1), be_const_closure(Leds_matrix_set_alternate_closure) }, + { be_const_key(set_bytes, -1), be_const_closure(Leds_matrix_set_bytes_closure) }, + { be_const_key(pix_buffer, 3), be_const_var(5) }, + { be_const_key(clear, -1), be_const_closure(Leds_matrix_clear_closure) }, + })), + (bstring*) &be_const_str_Leds_matrix +); + +/******************************************************************** +** Solidified function: create_matrix +********************************************************************/ +be_local_closure(Leds_create_matrix, /* name */ + be_nested_proto( + 10, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_nested_str(leds), + /* K2 */ be_nested_str(value_error), + /* K3 */ be_nested_str(out_X20of_X20range), + /* K4 */ be_const_class(be_class_Leds_matrix), + }), + &be_const_str_create_matrix, + &be_const_str_solidified, + ( &(const binstruction[37]) { /* code */ + 0x60100009, // 0000 GETGBL R4 G9 + 0x5C140600, // 0001 MOVE R5 R3 + 0x7C100200, // 0002 CALL R4 1 + 0x5C0C0800, // 0003 MOVE R3 R4 + 0x60100009, // 0004 GETGBL R4 G9 + 0x5C140200, // 0005 MOVE R5 R1 + 0x7C100200, // 0006 CALL R4 1 + 0x5C040800, // 0007 MOVE R1 R4 + 0x60100009, // 0008 GETGBL R4 G9 + 0x5C140400, // 0009 MOVE R5 R2 + 0x7C100200, // 000A CALL R4 1 + 0x5C080800, // 000B MOVE R2 R4 + 0x4C100000, // 000C LDNIL R4 + 0x1C100604, // 000D EQ R4 R3 R4 + 0x78120000, // 000E JMPF R4 #0010 + 0x580C0000, // 000F LDCONST R3 K0 + 0x08100202, // 0010 MUL R4 R1 R2 + 0x00100803, // 0011 ADD R4 R4 R3 + 0x88140101, // 0012 GETMBR R5 R0 K1 + 0x24100805, // 0013 GT R4 R4 R5 + 0x74120005, // 0014 JMPT R4 #001B + 0x14100500, // 0015 LT R4 R2 K0 + 0x74120003, // 0016 JMPT R4 #001B + 0x14100300, // 0017 LT R4 R1 K0 + 0x74120001, // 0018 JMPT R4 #001B + 0x14100700, // 0019 LT R4 R3 K0 + 0x78120000, // 001A JMPF R4 #001C + 0xB0060503, // 001B RAISE 1 K2 K3 + 0x58100004, // 001C LDCONST R4 K4 + 0xB4000004, // 001D CLASS K4 + 0x5C140800, // 001E MOVE R5 R4 + 0x5C180000, // 001F MOVE R6 R0 + 0x5C1C0200, // 0020 MOVE R7 R1 + 0x5C200400, // 0021 MOVE R8 R2 + 0x5C240600, // 0022 MOVE R9 R3 + 0x7C140800, // 0023 CALL R5 4 + 0x80040A00, // 0024 RET 1 R5 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified function: to_gamma ********************************************************************/ be_local_closure(Leds_to_gamma, /* name */ be_nested_proto( - 12, /* nstack */ + 8, /* nstack */ 3, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -1779,115 +1647,19 @@ be_local_closure(Leds_to_gamma, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 7]) { /* constants */ - /* K0 */ be_nested_str(tasmota), - /* K1 */ be_nested_str(scale_uint), - /* K2 */ be_const_int(0), - /* K3 */ be_const_int(16711680), - /* K4 */ be_nested_str(gamma), - /* K5 */ be_nested_str(light), - /* K6 */ be_nested_str(gamma8), + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(apply_bri_gamma), + /* K1 */ be_nested_str(gamma), }), &be_const_str_to_gamma, &be_const_str_solidified, - ( &(const binstruction[67]) { /* code */ - 0x4C0C0000, // 0000 LDNIL R3 - 0x200C0403, // 0001 NE R3 R2 R3 - 0x780E0001, // 0002 JMPF R3 #0005 - 0x5C0C0400, // 0003 MOVE R3 R2 - 0x70020000, // 0004 JMP #0006 - 0x540E0063, // 0005 LDINT R3 100 - 0x5C080600, // 0006 MOVE R2 R3 - 0xB80E0000, // 0007 GETNGBL R3 K0 - 0x8C0C0701, // 0008 GETMET R3 R3 K1 - 0x5C140400, // 0009 MOVE R5 R2 - 0x58180002, // 000A LDCONST R6 K2 - 0x541E0063, // 000B LDINT R7 100 - 0x58200002, // 000C LDCONST R8 K2 - 0x2C240303, // 000D AND R9 R1 K3 - 0x542A000F, // 000E LDINT R10 16 - 0x3C24120A, // 000F SHR R9 R9 R10 - 0x7C0C0C00, // 0010 CALL R3 6 - 0xB8120000, // 0011 GETNGBL R4 K0 - 0x8C100901, // 0012 GETMET R4 R4 K1 - 0x5C180400, // 0013 MOVE R6 R2 - 0x581C0002, // 0014 LDCONST R7 K2 - 0x54220063, // 0015 LDINT R8 100 - 0x58240002, // 0016 LDCONST R9 K2 - 0x542AFEFF, // 0017 LDINT R10 65280 - 0x2C28020A, // 0018 AND R10 R1 R10 - 0x542E0007, // 0019 LDINT R11 8 - 0x3C28140B, // 001A SHR R10 R10 R11 - 0x7C100C00, // 001B CALL R4 6 - 0xB8160000, // 001C GETNGBL R5 K0 - 0x8C140B01, // 001D GETMET R5 R5 K1 - 0x5C1C0400, // 001E MOVE R7 R2 - 0x58200002, // 001F LDCONST R8 K2 - 0x54260063, // 0020 LDINT R9 100 - 0x58280002, // 0021 LDCONST R10 K2 - 0x542E00FE, // 0022 LDINT R11 255 - 0x2C2C020B, // 0023 AND R11 R1 R11 - 0x7C140C00, // 0024 CALL R5 6 - 0x88180104, // 0025 GETMBR R6 R0 K4 - 0x781A0013, // 0026 JMPF R6 #003B - 0xB81A0A00, // 0027 GETNGBL R6 K5 - 0x8C180D06, // 0028 GETMET R6 R6 K6 - 0x5C200600, // 0029 MOVE R8 R3 - 0x7C180400, // 002A CALL R6 2 - 0x541E000F, // 002B LDINT R7 16 - 0x38180C07, // 002C SHL R6 R6 R7 - 0xB81E0A00, // 002D GETNGBL R7 K5 - 0x8C1C0F06, // 002E GETMET R7 R7 K6 - 0x5C240800, // 002F MOVE R9 R4 - 0x7C1C0400, // 0030 CALL R7 2 - 0x54220007, // 0031 LDINT R8 8 - 0x381C0E08, // 0032 SHL R7 R7 R8 - 0x30180C07, // 0033 OR R6 R6 R7 - 0xB81E0A00, // 0034 GETNGBL R7 K5 - 0x8C1C0F06, // 0035 GETMET R7 R7 K6 - 0x5C240A00, // 0036 MOVE R9 R5 - 0x7C1C0400, // 0037 CALL R7 2 - 0x30180C07, // 0038 OR R6 R6 R7 - 0x80040C00, // 0039 RET 1 R6 - 0x70020006, // 003A JMP #0042 - 0x541A000F, // 003B LDINT R6 16 - 0x38180606, // 003C SHL R6 R3 R6 - 0x541E0007, // 003D LDINT R7 8 - 0x381C0807, // 003E SHL R7 R4 R7 - 0x30180C07, // 003F OR R6 R6 R7 - 0x30180C05, // 0040 OR R6 R6 R5 - 0x80040C00, // 0041 RET 1 R6 - 0x80000000, // 0042 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: begin -********************************************************************/ -be_local_closure(Leds_begin, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(call_native), - /* K1 */ be_const_int(1), - }), - &be_const_str_begin, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x580C0001, // 0001 LDCONST R3 K1 - 0x7C040400, // 0002 CALL R1 2 - 0x80000000, // 0003 RET 0 + ( &(const binstruction[ 6]) { /* code */ + 0x8C0C0100, // 0000 GETMET R3 R0 K0 + 0x5C140200, // 0001 MOVE R5 R1 + 0x5C180400, // 0002 MOVE R6 R2 + 0x881C0101, // 0003 GETMBR R7 R0 K1 + 0x7C0C0800, // 0004 CALL R3 4 + 0x80040600, // 0005 RET 1 R3 }) ) ); @@ -1942,9 +1714,159 @@ be_local_closure(Leds_ctor, /* name */ /******************************************************************** -** Solidified function: can_show +** Solidified function: dirty ********************************************************************/ -be_local_closure(Leds_can_show, /* name */ +be_local_closure(Leds_dirty, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(call_native), + }), + &be_const_str_dirty, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0004, // 0001 LDINT R3 5 + 0x7C040400, // 0002 CALL R1 2 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: clear_to +********************************************************************/ +be_local_closure(Leds_clear_to, /* name */ + be_nested_proto( + 10, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(call_native), + /* K1 */ be_nested_str(to_gamma), + }), + &be_const_str_clear_to, + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x8C0C0100, // 0000 GETMET R3 R0 K0 + 0x54160008, // 0001 LDINT R5 9 + 0x8C180101, // 0002 GETMET R6 R0 K1 + 0x5C200200, // 0003 MOVE R8 R1 + 0x5C240400, // 0004 MOVE R9 R2 + 0x7C180600, // 0005 CALL R6 3 + 0x7C0C0600, // 0006 CALL R3 3 + 0x80000000, // 0007 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_pixel_color +********************************************************************/ +be_local_closure(Leds_get_pixel_color, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(call_native), + }), + &be_const_str_get_pixel_color, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x5412000A, // 0001 LDINT R4 11 + 0x5C140200, // 0002 MOVE R5 R1 + 0x7C080600, // 0003 CALL R2 3 + 0x80040400, // 0004 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Leds_init, /* name */ + be_nested_proto( + 11, /* nstack */ + 5, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str(gamma), + /* K1 */ be_nested_str(leds), + /* K2 */ be_nested_str(valuer_error), + /* K3 */ be_nested_str(no_X20GPIO_X20specified_X20for_X20neopixelbus), + /* K4 */ be_nested_str(ctor), + /* K5 */ be_nested_str(_p), + /* K6 */ be_nested_str(internal_error), + /* K7 */ be_nested_str(couldn_X27t_X20not_X20initialize_X20noepixelbus), + /* K8 */ be_nested_str(begin), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[24]) { /* code */ + 0x50140200, // 0000 LDBOOL R5 1 0 + 0x90020005, // 0001 SETMBR R0 K0 R5 + 0x60140009, // 0002 GETGBL R5 G9 + 0x5C180200, // 0003 MOVE R6 R1 + 0x7C140200, // 0004 CALL R5 1 + 0x90020205, // 0005 SETMBR R0 K1 R5 + 0x4C140000, // 0006 LDNIL R5 + 0x1C140405, // 0007 EQ R5 R2 R5 + 0x78160000, // 0008 JMPF R5 #000A + 0xB0060503, // 0009 RAISE 1 K2 K3 + 0x8C140104, // 000A GETMET R5 R0 K4 + 0x881C0101, // 000B GETMBR R7 R0 K1 + 0x5C200400, // 000C MOVE R8 R2 + 0x5C240600, // 000D MOVE R9 R3 + 0x5C280800, // 000E MOVE R10 R4 + 0x7C140A00, // 000F CALL R5 5 + 0x88140105, // 0010 GETMBR R5 R0 K5 + 0x4C180000, // 0011 LDNIL R6 + 0x1C140A06, // 0012 EQ R5 R5 R6 + 0x78160000, // 0013 JMPF R5 #0015 + 0xB0060D07, // 0014 RAISE 1 K6 K7 + 0x8C140108, // 0015 GETMET R5 R0 K8 + 0x7C140200, // 0016 CALL R5 1 + 0x80000000, // 0017 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: begin +********************************************************************/ +be_local_closure(Leds_begin, /* name */ be_nested_proto( 4, /* nstack */ 1, /* argc */ @@ -1956,14 +1878,102 @@ be_local_closure(Leds_can_show, /* name */ 1, /* has constants */ ( &(const bvalue[ 2]) { /* constants */ /* K0 */ be_nested_str(call_native), - /* K1 */ be_const_int(3), + /* K1 */ be_const_int(1), }), - &be_const_str_can_show, + &be_const_str_begin, &be_const_str_solidified, ( &(const binstruction[ 4]) { /* code */ 0x8C040100, // 0000 GETMET R1 R0 K0 0x580C0001, // 0001 LDCONST R3 K1 0x7C040400, // 0002 CALL R1 2 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_offset +********************************************************************/ +be_local_closure(Leds_pixel_offset, /* name */ + be_nested_proto( + 1, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_const_int(0), + }), + &be_const_str_pixel_offset, + &be_const_str_solidified, + ( &(const binstruction[ 1]) { /* code */ + 0x80060000, // 0000 RET 1 K0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: clear +********************************************************************/ +be_local_closure(Leds_clear, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(clear_to), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(show), + }), + &be_const_str_clear, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x580C0001, // 0001 LDCONST R3 K1 + 0x7C040400, // 0002 CALL R1 2 + 0x8C040102, // 0003 GETMET R1 R0 K2 + 0x7C040200, // 0004 CALL R1 1 + 0x80000000, // 0005 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_size +********************************************************************/ +be_local_closure(Leds_pixel_size, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(call_native), + }), + &be_const_str_pixel_size, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0006, // 0001 LDINT R3 7 + 0x7C040400, // 0002 CALL R1 2 0x80040200, // 0003 RET 1 R1 }) ) @@ -1978,29 +1988,30 @@ extern const bclass be_class_Leds_ntv; be_local_class(Leds, 2, &be_class_Leds_ntv, - be_nested_map(21, + be_nested_map(22, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(pixel_count, -1), be_const_closure(Leds_pixel_count_closure) }, { be_const_key(show, -1), be_const_closure(Leds_show_closure) }, - { be_const_key(is_dirty, -1), be_const_closure(Leds_is_dirty_closure) }, - { be_const_key(leds, 17), be_const_var(1) }, - { be_const_key(set_pixel_color, 8), be_const_closure(Leds_set_pixel_color_closure) }, - { be_const_key(clear, -1), be_const_closure(Leds_clear_closure) }, - { be_const_key(matrix, -1), be_const_static_closure(Leds_matrix_closure) }, { be_const_key(create_segment, -1), be_const_closure(Leds_create_segment_closure) }, - { be_const_key(ctor, 2), be_const_closure(Leds_ctor_closure) }, - { be_const_key(clear_to, 19), be_const_closure(Leds_clear_to_closure) }, - { be_const_key(create_matrix, -1), be_const_closure(Leds_create_matrix_closure) }, - { be_const_key(pixels_buffer, -1), be_const_closure(Leds_pixels_buffer_closure) }, - { be_const_key(init, -1), be_const_closure(Leds_init_closure) }, - { be_const_key(dirty, -1), be_const_closure(Leds_dirty_closure) }, - { be_const_key(get_pixel_color, -1), be_const_closure(Leds_get_pixel_color_closure) }, { be_const_key(assign_rmt, -1), be_const_static_closure(Leds_assign_rmt_closure) }, { be_const_key(pixel_size, -1), be_const_closure(Leds_pixel_size_closure) }, - { be_const_key(to_gamma, 16), be_const_closure(Leds_to_gamma_closure) }, - { be_const_key(begin, -1), be_const_closure(Leds_begin_closure) }, - { be_const_key(gamma, -1), be_const_var(0) }, - { be_const_key(can_show, -1), be_const_closure(Leds_can_show_closure) }, + { be_const_key(matrix, 18), be_const_static_closure(Leds_matrix_closure) }, + { be_const_key(pixel_count, -1), be_const_closure(Leds_pixel_count_closure) }, + { be_const_key(ctor, -1), be_const_closure(Leds_ctor_closure) }, + { be_const_key(pixels_buffer, -1), be_const_closure(Leds_pixels_buffer_closure) }, + { be_const_key(set_pixel_color, -1), be_const_closure(Leds_set_pixel_color_closure) }, + { be_const_key(create_matrix, 15), be_const_closure(Leds_create_matrix_closure) }, + { be_const_key(is_dirty, 14), be_const_closure(Leds_is_dirty_closure) }, + { be_const_key(can_show, 6), be_const_closure(Leds_can_show_closure) }, + { be_const_key(to_gamma, -1), be_const_closure(Leds_to_gamma_closure) }, + { be_const_key(dirty, 19), be_const_closure(Leds_dirty_closure) }, + { be_const_key(begin, 12), be_const_closure(Leds_begin_closure) }, + { be_const_key(init, -1), be_const_closure(Leds_init_closure) }, + { be_const_key(gamma, 17), be_const_var(0) }, + { be_const_key(get_pixel_color, -1), be_const_closure(Leds_get_pixel_color_closure) }, + { be_const_key(clear_to, -1), be_const_closure(Leds_clear_to_closure) }, + { be_const_key(leds, -1), be_const_var(1) }, + { be_const_key(clear, -1), be_const_closure(Leds_clear_closure) }, + { be_const_key(pixel_offset, 3), be_const_closure(Leds_pixel_offset_closure) }, })), (bstring*) &be_const_str_Leds ); diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_animate_effects.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_animate_effects.h new file mode 100644 index 000000000..63e971fdd --- /dev/null +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_animate_effects.h @@ -0,0 +1,358 @@ +/* Solidification of leds_animate_effects.h */ +/********************************************************************\ +* Generated code, don't edit * +\********************************************************************/ +#include "be_constobj.h" + +extern const bclass be_class_Leds_pulse; + +/******************************************************************** +** Solidified function: set_slew_size +********************************************************************/ +be_local_closure(Leds_pulse_set_slew_size, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(slew_size), + }), + be_str_weak(set_slew_size), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_back_color +********************************************************************/ +be_local_closure(Leds_pulse_set_back_color, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(back_color), + }), + be_str_weak(set_back_color), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_index +********************************************************************/ +be_local_closure(Leds_pulse_set_index, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(index), + }), + be_str_weak(set_index), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_pulse_size +********************************************************************/ +be_local_closure(Leds_pulse_set_pulse_size, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(pulse_size), + }), + be_str_weak(set_pulse_size), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Leds_pulse_init, /* name */ + be_nested_proto( + 5, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_const_int(16777215), + /* K1 */ be_const_int(1), + /* K2 */ be_const_int(0), + /* K3 */ be_nested_str_weak(color), + /* K4 */ be_nested_str_weak(back_color), + /* K5 */ be_const_int(-16777216), + /* K6 */ be_nested_str_weak(pulse_size), + /* K7 */ be_nested_str_weak(slew_size), + }), + be_str_weak(init), + &be_const_str_solidified, + ( &(const binstruction[23]) { /* code */ + 0x4C100000, // 0000 LDNIL R4 + 0x1C100204, // 0001 EQ R4 R1 R4 + 0x78120000, // 0002 JMPF R4 #0004 + 0x58040000, // 0003 LDCONST R1 K0 + 0x4C100000, // 0004 LDNIL R4 + 0x1C100404, // 0005 EQ R4 R2 R4 + 0x78120000, // 0006 JMPF R4 #0008 + 0x58080001, // 0007 LDCONST R2 K1 + 0x4C100000, // 0008 LDNIL R4 + 0x1C100604, // 0009 EQ R4 R3 R4 + 0x78120000, // 000A JMPF R4 #000C + 0x580C0002, // 000B LDCONST R3 K2 + 0x90020601, // 000C SETMBR R0 K3 R1 + 0x90020905, // 000D SETMBR R0 K4 K5 + 0x14100502, // 000E LT R4 R2 K2 + 0x78120000, // 000F JMPF R4 #0011 + 0x58080002, // 0010 LDCONST R2 K2 + 0x90020C02, // 0011 SETMBR R0 K6 R2 + 0x14100702, // 0012 LT R4 R3 K2 + 0x78120000, // 0013 JMPF R4 #0015 + 0x580C0002, // 0014 LDCONST R3 K2 + 0x90020E03, // 0015 SETMBR R0 K7 R3 + 0x80000000, // 0016 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_color +********************************************************************/ +be_local_closure(Leds_pulse_set_color, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(color), + }), + be_str_weak(set_color), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: paint +********************************************************************/ +be_local_closure(Leds_pulse_paint, /* name */ + be_nested_proto( + 22, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[13]) { /* constants */ + /* K0 */ be_nested_str_weak(back_color), + /* K1 */ be_const_int(-16777216), + /* K2 */ be_nested_str_weak(fill_pixels), + /* K3 */ be_nested_str_weak(index), + /* K4 */ be_nested_str_weak(slew_size), + /* K5 */ be_nested_str_weak(pulse_size), + /* K6 */ be_nested_str_weak(color), + /* K7 */ be_nested_str_weak(pixel_size), + /* K8 */ be_const_int(0), + /* K9 */ be_const_int(1), + /* K10 */ be_nested_str_weak(blend), + /* K11 */ be_nested_str_weak(tasmota), + /* K12 */ be_nested_str_weak(scale_int), + }), + be_str_weak(paint), + &be_const_str_solidified, + ( &(const binstruction[91]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x200C0501, // 0001 NE R3 R2 K1 + 0x780E0002, // 0002 JMPF R3 #0006 + 0x8C0C0302, // 0003 GETMET R3 R1 K2 + 0x5C140400, // 0004 MOVE R5 R2 + 0x7C0C0400, // 0005 CALL R3 2 + 0x880C0103, // 0006 GETMBR R3 R0 K3 + 0x88100104, // 0007 GETMBR R4 R0 K4 + 0x88140105, // 0008 GETMBR R5 R0 K5 + 0x88180106, // 0009 GETMBR R6 R0 K6 + 0x881C0307, // 000A GETMBR R7 R1 K7 + 0x4C200000, // 000B LDNIL R8 + 0x4C240000, // 000C LDNIL R9 + 0x5C200600, // 000D MOVE R8 R3 + 0x00280605, // 000E ADD R10 R3 R5 + 0x5C241400, // 000F MOVE R9 R10 + 0x14281108, // 0010 LT R10 R8 K8 + 0x782A0000, // 0011 JMPF R10 #0013 + 0x58200008, // 0012 LDCONST R8 K8 + 0x28281207, // 0013 GE R10 R9 R7 + 0x782A0000, // 0014 JMPF R10 #0016 + 0x5C240E00, // 0015 MOVE R9 R7 + 0x5C281000, // 0016 MOVE R10 R8 + 0x142C1409, // 0017 LT R11 R10 R9 + 0x782E0002, // 0018 JMPF R11 #001C + 0x98041406, // 0019 SETIDX R1 R10 R6 + 0x00281509, // 001A ADD R10 R10 K9 + 0x7001FFFA, // 001B JMP #0017 + 0x242C0908, // 001C GT R11 R4 K8 + 0x782E003A, // 001D JMPF R11 #0059 + 0x042C0604, // 001E SUB R11 R3 R4 + 0x5C201600, // 001F MOVE R8 R11 + 0x5C240600, // 0020 MOVE R9 R3 + 0x142C1108, // 0021 LT R11 R8 K8 + 0x782E0000, // 0022 JMPF R11 #0024 + 0x58200008, // 0023 LDCONST R8 K8 + 0x282C1207, // 0024 GE R11 R9 R7 + 0x782E0000, // 0025 JMPF R11 #0027 + 0x5C240E00, // 0026 MOVE R9 R7 + 0x5C281000, // 0027 MOVE R10 R8 + 0x142C1409, // 0028 LT R11 R10 R9 + 0x782E000F, // 0029 JMPF R11 #003A + 0x8C2C030A, // 002A GETMET R11 R1 K10 + 0x5C340400, // 002B MOVE R13 R2 + 0x5C380C00, // 002C MOVE R14 R6 + 0xB83E1600, // 002D GETNGBL R15 K11 + 0x8C3C1F0C, // 002E GETMET R15 R15 K12 + 0x5C441400, // 002F MOVE R17 R10 + 0x04480604, // 0030 SUB R18 R3 R4 + 0x04482509, // 0031 SUB R18 R18 K9 + 0x5C4C0600, // 0032 MOVE R19 R3 + 0x545200FE, // 0033 LDINT R20 255 + 0x58540008, // 0034 LDCONST R21 K8 + 0x7C3C0C00, // 0035 CALL R15 6 + 0x7C2C0800, // 0036 CALL R11 4 + 0x9804140B, // 0037 SETIDX R1 R10 R11 + 0x00281509, // 0038 ADD R10 R10 K9 + 0x7001FFED, // 0039 JMP #0028 + 0x002C0605, // 003A ADD R11 R3 R5 + 0x5C201600, // 003B MOVE R8 R11 + 0x002C0605, // 003C ADD R11 R3 R5 + 0x002C1604, // 003D ADD R11 R11 R4 + 0x5C241600, // 003E MOVE R9 R11 + 0x142C1108, // 003F LT R11 R8 K8 + 0x782E0000, // 0040 JMPF R11 #0042 + 0x58200008, // 0041 LDCONST R8 K8 + 0x282C1207, // 0042 GE R11 R9 R7 + 0x782E0000, // 0043 JMPF R11 #0045 + 0x5C240E00, // 0044 MOVE R9 R7 + 0x5C281000, // 0045 MOVE R10 R8 + 0x142C1409, // 0046 LT R11 R10 R9 + 0x782E0010, // 0047 JMPF R11 #0059 + 0x8C2C030A, // 0048 GETMET R11 R1 K10 + 0x5C340400, // 0049 MOVE R13 R2 + 0x5C380C00, // 004A MOVE R14 R6 + 0xB83E1600, // 004B GETNGBL R15 K11 + 0x8C3C1F0C, // 004C GETMET R15 R15 K12 + 0x5C441400, // 004D MOVE R17 R10 + 0x00480605, // 004E ADD R18 R3 R5 + 0x04482509, // 004F SUB R18 R18 K9 + 0x004C0605, // 0050 ADD R19 R3 R5 + 0x004C2604, // 0051 ADD R19 R19 R4 + 0x58500008, // 0052 LDCONST R20 K8 + 0x545600FE, // 0053 LDINT R21 255 + 0x7C3C0C00, // 0054 CALL R15 6 + 0x7C2C0800, // 0055 CALL R11 4 + 0x9804140B, // 0056 SETIDX R1 R10 R11 + 0x00281509, // 0057 ADD R10 R10 K9 + 0x7001FFEC, // 0058 JMP #0046 + 0x502C0200, // 0059 LDBOOL R11 1 0 + 0x80041600, // 005A RET 1 R11 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Leds_pulse +********************************************************************/ +be_local_class(Leds_pulse, + 5, + NULL, + be_nested_map(12, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(paint, 9), be_const_closure(Leds_pulse_paint_closure) }, + { be_const_key_weak(set_slew_size, -1), be_const_closure(Leds_pulse_set_slew_size_closure) }, + { be_const_key_weak(pulse_size, -1), be_const_var(4) }, + { be_const_key_weak(set_back_color, 6), be_const_closure(Leds_pulse_set_back_color_closure) }, + { be_const_key_weak(set_index, 7), be_const_closure(Leds_pulse_set_index_closure) }, + { be_const_key_weak(back_color, -1), be_const_var(1) }, + { be_const_key_weak(set_color, 8), be_const_closure(Leds_pulse_set_color_closure) }, + { be_const_key_weak(color, -1), be_const_var(0) }, + { be_const_key_weak(init, -1), be_const_closure(Leds_pulse_init_closure) }, + { be_const_key_weak(set_pulse_size, -1), be_const_closure(Leds_pulse_set_pulse_size_closure) }, + { be_const_key_weak(slew_size, 5), be_const_var(3) }, + { be_const_key_weak(index, 0), be_const_var(2) }, + })), + be_str_weak(Leds_pulse) +); +/*******************************************************************/ + +void be_load_Leds_pulse_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Leds_pulse); + be_setglobal(vm, "Leds_pulse"); + be_pop(vm, 1); +} +/********************************************************************/ +/* End of solidification */ diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_animator.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_animator.h index 992fae52b..159dc5df2 100644 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_animator.h +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_animator.h @@ -6,223 +6,6 @@ extern const bclass be_class_Leds_animator; -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Leds_animator_init, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 1, /* has sup protos */ - ( &(const struct bproto*[ 1]) { - be_nested_proto( - 2, /* nstack */ - 0, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(fast_loop), - }), - be_str_weak(_X3Clambda_X3E), - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x68000000, // 0000 GETUPV R0 U0 - 0x8C000100, // 0001 GETMET R0 R0 K0 - 0x7C000200, // 0002 CALL R0 1 - 0x80040000, // 0003 RET 1 R0 - }) - ), - }), - 1, /* has constants */ - ( &(const bvalue[ 8]) { /* constants */ - /* K0 */ be_nested_str_weak(strip), - /* K1 */ be_nested_str_weak(bri), - /* K2 */ be_nested_str_weak(running), - /* K3 */ be_nested_str_weak(pixel_count), - /* K4 */ be_nested_str_weak(animators), - /* K5 */ be_nested_str_weak(clear), - /* K6 */ be_nested_str_weak(tasmota), - /* K7 */ be_nested_str_weak(add_fast_loop), - }), - be_str_weak(init), - &be_const_str_solidified, - ( &(const binstruction[19]) { /* code */ - 0x90020001, // 0000 SETMBR R0 K0 R1 - 0x540A0031, // 0001 LDINT R2 50 - 0x90020202, // 0002 SETMBR R0 K1 R2 - 0x50080000, // 0003 LDBOOL R2 0 0 - 0x90020402, // 0004 SETMBR R0 K2 R2 - 0x8C080303, // 0005 GETMET R2 R1 K3 - 0x7C080200, // 0006 CALL R2 1 - 0x90020602, // 0007 SETMBR R0 K3 R2 - 0x60080012, // 0008 GETGBL R2 G18 - 0x7C080000, // 0009 CALL R2 0 - 0x90020802, // 000A SETMBR R0 K4 R2 - 0x8C080105, // 000B GETMET R2 R0 K5 - 0x7C080200, // 000C CALL R2 1 - 0xB80A0C00, // 000D GETNGBL R2 K6 - 0x8C080507, // 000E GETMET R2 R2 K7 - 0x84100000, // 000F CLOSURE R4 P0 - 0x7C080400, // 0010 CALL R2 2 - 0xA0000000, // 0011 CLOSE R0 - 0x80000000, // 0012 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: add_anim -********************************************************************/ -be_local_closure(Leds_animator_add_anim, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str_weak(animators), - /* K1 */ be_nested_str_weak(push), - /* K2 */ be_nested_str_weak(run), - }), - be_str_weak(add_anim), - &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x5C100200, // 0002 MOVE R4 R1 - 0x7C080400, // 0003 CALL R2 2 - 0x8C080302, // 0004 GETMET R2 R1 K2 - 0x7C080200, // 0005 CALL R2 1 - 0x80000000, // 0006 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: stop -********************************************************************/ -be_local_closure(Leds_animator_stop, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(running), - }), - be_str_weak(stop), - &be_const_str_solidified, - ( &(const binstruction[ 3]) { /* code */ - 0x50040000, // 0000 LDBOOL R1 0 0 - 0x90020001, // 0001 SETMBR R0 K0 R1 - 0x80000000, // 0002 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: fast_loop -********************************************************************/ -be_local_closure(Leds_animator_fast_loop, /* name */ - be_nested_proto( - 6, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 7]) { /* constants */ - /* K0 */ be_nested_str_weak(running), - /* K1 */ be_const_int(0), - /* K2 */ be_nested_str_weak(animators), - /* K3 */ be_nested_str_weak(is_running), - /* K4 */ be_nested_str_weak(animate), - /* K5 */ be_const_int(1), - /* K6 */ be_nested_str_weak(remove), - }), - be_str_weak(fast_loop), - &be_const_str_solidified, - ( &(const binstruction[25]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x78060015, // 0001 JMPF R1 #0018 - 0x58040001, // 0002 LDCONST R1 K1 - 0x6008000C, // 0003 GETGBL R2 G12 - 0x880C0102, // 0004 GETMBR R3 R0 K2 - 0x7C080200, // 0005 CALL R2 1 - 0x14080202, // 0006 LT R2 R1 R2 - 0x780A000D, // 0007 JMPF R2 #0016 - 0x88080102, // 0008 GETMBR R2 R0 K2 - 0x94080401, // 0009 GETIDX R2 R2 R1 - 0x8C0C0503, // 000A GETMET R3 R2 K3 - 0x7C0C0200, // 000B CALL R3 1 - 0x780E0003, // 000C JMPF R3 #0011 - 0x8C0C0504, // 000D GETMET R3 R2 K4 - 0x7C0C0200, // 000E CALL R3 1 - 0x00040305, // 000F ADD R1 R1 K5 - 0x70020003, // 0010 JMP #0015 - 0x880C0102, // 0011 GETMBR R3 R0 K2 - 0x8C0C0706, // 0012 GETMET R3 R3 K6 - 0x5C140200, // 0013 MOVE R5 R1 - 0x7C0C0400, // 0014 CALL R3 2 - 0x7001FFEC, // 0015 JMP #0003 - 0x8C080104, // 0016 GETMET R2 R0 K4 - 0x7C080200, // 0017 CALL R2 1 - 0x80000000, // 0018 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: animate -********************************************************************/ -be_local_closure(Leds_animator_animate, /* name */ - be_nested_proto( - 1, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 0, /* has constants */ - NULL, /* no const */ - be_str_weak(animate), - &be_const_str_solidified, - ( &(const binstruction[ 1]) { /* code */ - 0x80000000, // 0000 RET 0 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified function: remove ********************************************************************/ @@ -236,18 +19,22 @@ be_local_closure(Leds_animator_remove, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(tasmota), - /* K1 */ be_nested_str_weak(remove_driver), + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str_weak(clear), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(remove_fast_loop), + /* K3 */ be_nested_str_weak(fast_loop_cb), }), be_str_weak(remove), &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0xB8060000, // 0000 GETNGBL R1 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x5C0C0000, // 0002 MOVE R3 R0 - 0x7C040400, // 0003 CALL R1 2 - 0x80000000, // 0004 RET 0 + ( &(const binstruction[ 7]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x7C040200, // 0001 CALL R1 1 + 0xB8060200, // 0002 GETNGBL R1 K1 + 0x8C040302, // 0003 GETMET R1 R1 K2 + 0x880C0103, // 0004 GETMBR R3 R0 K3 + 0x7C040400, // 0005 CALL R1 2 + 0x80000000, // 0006 RET 0 }) ) ); @@ -255,11 +42,11 @@ be_local_closure(Leds_animator_remove, /* name */ /******************************************************************** -** Solidified function: set_bri +** Solidified function: add_background_animator ********************************************************************/ -be_local_closure(Leds_animator_set_bri, /* name */ +be_local_closure(Leds_animator_add_background_animator, /* name */ be_nested_proto( - 2, /* nstack */ + 6, /* nstack */ 2, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -267,69 +54,22 @@ be_local_closure(Leds_animator_set_bri, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(bri), + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str_weak(set_cb), + /* K1 */ be_nested_str_weak(set_back_color), + /* K2 */ be_nested_str_weak(add_animator), }), - be_str_weak(set_bri), + be_str_weak(add_background_animator), &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x90020001, // 0000 SETMBR R0 K0 R1 - 0x80000000, // 0001 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_bri -********************************************************************/ -be_local_closure(Leds_animator_get_bri, /* name */ - be_nested_proto( - 3, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(bri), - }), - be_str_weak(get_bri), - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x80040400, // 0001 RET 1 R2 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: start -********************************************************************/ -be_local_closure(Leds_animator_start, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(running), - }), - be_str_weak(start), - &be_const_str_solidified, - ( &(const binstruction[ 3]) { /* code */ - 0x50040200, // 0000 LDBOOL R1 1 0 - 0x90020001, // 0001 SETMBR R0 K0 R1 - 0x80000000, // 0002 RET 0 + ( &(const binstruction[ 8]) { /* code */ + 0x8C080300, // 0000 GETMET R2 R1 K0 + 0x5C100000, // 0001 MOVE R4 R0 + 0x88140101, // 0002 GETMBR R5 R0 K1 + 0x7C080600, // 0003 CALL R2 3 + 0x8C080102, // 0004 GETMET R2 R0 K2 + 0x5C100200, // 0005 MOVE R4 R1 + 0x7C080400, // 0006 CALL R2 2 + 0x80000000, // 0007 RET 0 }) ) ); @@ -369,29 +109,568 @@ be_local_closure(Leds_animator_clear, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: add_animator +********************************************************************/ +be_local_closure(Leds_animator_add_animator, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(animators), + /* K1 */ be_nested_str_weak(push), + }), + be_str_weak(add_animator), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100200, // 0002 MOVE R4 R1 + 0x7C080400, // 0003 CALL R2 2 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: animate +********************************************************************/ +be_local_closure(Leds_animator_animate, /* name */ + be_nested_proto( + 1, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + be_str_weak(animate), + &be_const_str_solidified, + ( &(const binstruction[ 1]) { /* code */ + 0x80000000, // 0000 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_bri +********************************************************************/ +be_local_closure(Leds_animator_get_bri, /* name */ + be_nested_proto( + 3, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(bri), + }), + be_str_weak(get_bri), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x80040400, // 0001 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_bri +********************************************************************/ +be_local_closure(Leds_animator_set_bri, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(bri), + }), + be_str_weak(set_bri), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_back_color +********************************************************************/ +be_local_closure(Leds_animator_set_back_color, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(back_color), + }), + be_str_weak(set_back_color), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: stop +********************************************************************/ +be_local_closure(Leds_animator_stop, /* name */ + be_nested_proto( + 6, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str_weak(running), + /* K1 */ be_nested_str_weak(animators), + /* K2 */ be_const_int(0), + /* K3 */ be_nested_str_weak(stop), + /* K4 */ be_const_int(1), + /* K5 */ be_nested_str_weak(tasmota), + /* K6 */ be_nested_str_weak(remove_fast_loop), + /* K7 */ be_nested_str_weak(fast_loop_cb), + }), + be_str_weak(stop), + &be_const_str_solidified, + ( &(const binstruction[19]) { /* code */ + 0x50040000, // 0000 LDBOOL R1 0 0 + 0x90020001, // 0001 SETMBR R0 K0 R1 + 0x88040101, // 0002 GETMBR R1 R0 K1 + 0x58080002, // 0003 LDCONST R2 K2 + 0x600C000C, // 0004 GETGBL R3 G12 + 0x5C100200, // 0005 MOVE R4 R1 + 0x7C0C0200, // 0006 CALL R3 1 + 0x140C0403, // 0007 LT R3 R2 R3 + 0x780E0004, // 0008 JMPF R3 #000E + 0x940C0202, // 0009 GETIDX R3 R1 R2 + 0x8C0C0703, // 000A GETMET R3 R3 K3 + 0x7C0C0200, // 000B CALL R3 1 + 0x00080504, // 000C ADD R2 R2 K4 + 0x7001FFF5, // 000D JMP #0004 + 0xB80E0A00, // 000E GETNGBL R3 K5 + 0x8C0C0706, // 000F GETMET R3 R3 K6 + 0x88140107, // 0010 GETMBR R5 R0 K7 + 0x7C0C0400, // 0011 CALL R3 2 + 0x80000000, // 0012 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_cb +********************************************************************/ +be_local_closure(Leds_animator_set_cb, /* name */ + be_nested_proto( + 3, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(animate_object), + /* K1 */ be_nested_str_weak(animate_method), + }), + be_str_weak(set_cb), + &be_const_str_solidified, + ( &(const binstruction[ 3]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x90020202, // 0001 SETMBR R0 K1 R2 + 0x80000000, // 0002 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Leds_animator_init, /* name */ + be_nested_proto( + 5, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 1]) { + be_nested_proto( + 2, /* nstack */ + 0, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(fast_loop), + }), + be_str_weak(_anonymous_), + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x68000000, // 0000 GETUPV R0 U0 + 0x8C000100, // 0001 GETMET R0 R0 K0 + 0x7C000200, // 0002 CALL R0 1 + 0x80000000, // 0003 RET 0 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[13]) { /* constants */ + /* K0 */ be_nested_str_weak(strip), + /* K1 */ be_nested_str_weak(bri), + /* K2 */ be_nested_str_weak(running), + /* K3 */ be_nested_str_weak(pixel_count), + /* K4 */ be_nested_str_weak(animators), + /* K5 */ be_nested_str_weak(painters), + /* K6 */ be_nested_str_weak(clear), + /* K7 */ be_nested_str_weak(frame), + /* K8 */ be_nested_str_weak(Leds_frame), + /* K9 */ be_nested_str_weak(layer), + /* K10 */ be_nested_str_weak(fast_loop_cb), + /* K11 */ be_nested_str_weak(back_color), + /* K12 */ be_const_int(0), + }), + be_str_weak(init), + &be_const_str_solidified, + ( &(const binstruction[32]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x4C0C0000, // 0001 LDNIL R3 + 0x1C0C0403, // 0002 EQ R3 R2 R3 + 0x780E0000, // 0003 JMPF R3 #0005 + 0x540A0031, // 0004 LDINT R2 50 + 0x90020202, // 0005 SETMBR R0 K1 R2 + 0x500C0000, // 0006 LDBOOL R3 0 0 + 0x90020403, // 0007 SETMBR R0 K2 R3 + 0x8C0C0303, // 0008 GETMET R3 R1 K3 + 0x7C0C0200, // 0009 CALL R3 1 + 0x90020603, // 000A SETMBR R0 K3 R3 + 0x600C0012, // 000B GETGBL R3 G18 + 0x7C0C0000, // 000C CALL R3 0 + 0x90020803, // 000D SETMBR R0 K4 R3 + 0x600C0012, // 000E GETGBL R3 G18 + 0x7C0C0000, // 000F CALL R3 0 + 0x90020A03, // 0010 SETMBR R0 K5 R3 + 0x8C0C0106, // 0011 GETMET R3 R0 K6 + 0x7C0C0200, // 0012 CALL R3 1 + 0xB80E1000, // 0013 GETNGBL R3 K8 + 0x88100103, // 0014 GETMBR R4 R0 K3 + 0x7C0C0200, // 0015 CALL R3 1 + 0x90020E03, // 0016 SETMBR R0 K7 R3 + 0xB80E1000, // 0017 GETNGBL R3 K8 + 0x88100103, // 0018 GETMBR R4 R0 K3 + 0x7C0C0200, // 0019 CALL R3 1 + 0x90021203, // 001A SETMBR R0 K9 R3 + 0x840C0000, // 001B CLOSURE R3 P0 + 0x90021403, // 001C SETMBR R0 K10 R3 + 0x9002170C, // 001D SETMBR R0 K11 K12 + 0xA0000000, // 001E CLOSE R0 + 0x80000000, // 001F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: add_painter +********************************************************************/ +be_local_closure(Leds_animator_add_painter, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(painters), + /* K1 */ be_nested_str_weak(push), + }), + be_str_weak(add_painter), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100200, // 0002 MOVE R4 R1 + 0x7C080400, // 0003 CALL R2 2 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: fast_loop +********************************************************************/ +be_local_closure(Leds_animator_fast_loop, /* name */ + be_nested_proto( + 12, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[28]) { /* constants */ + /* K0 */ be_nested_str_weak(running), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(time_reached), + /* K3 */ be_nested_str_weak(fast_loop_next), + /* K4 */ be_nested_str_weak(strip), + /* K5 */ be_nested_str_weak(can_show), + /* K6 */ be_nested_str_weak(frame), + /* K7 */ be_nested_str_weak(fill_pixels), + /* K8 */ be_nested_str_weak(back_color), + /* K9 */ be_const_int(0), + /* K10 */ be_nested_str_weak(millis), + /* K11 */ be_nested_str_weak(FAST_LOOP_MIN), + /* K12 */ be_nested_str_weak(animators), + /* K13 */ be_nested_str_weak(animate), + /* K14 */ be_const_int(1), + /* K15 */ be_nested_str_weak(layer), + /* K16 */ be_nested_str_weak(painters), + /* K17 */ be_const_int(-16777216), + /* K18 */ be_nested_str_weak(paint), + /* K19 */ be_nested_str_weak(blend_pixels), + /* K20 */ be_nested_str_weak(animate_object), + /* K21 */ be_nested_str_weak(animate_method), + /* K22 */ be_nested_str_weak(paste_pixels), + /* K23 */ be_nested_str_weak(pixels_buffer), + /* K24 */ be_nested_str_weak(bri), + /* K25 */ be_nested_str_weak(gamma), + /* K26 */ be_nested_str_weak(dirty), + /* K27 */ be_nested_str_weak(show), + }), + be_str_weak(fast_loop), + &be_const_str_solidified, + ( &(const binstruction[81]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x7806004D, // 0001 JMPF R1 #0050 + 0xB8060200, // 0002 GETNGBL R1 K1 + 0x8C040302, // 0003 GETMET R1 R1 K2 + 0x880C0103, // 0004 GETMBR R3 R0 K3 + 0x7C040400, // 0005 CALL R1 2 + 0x78060048, // 0006 JMPF R1 #0050 + 0x88040104, // 0007 GETMBR R1 R0 K4 + 0x8C040305, // 0008 GETMET R1 R1 K5 + 0x7C040200, // 0009 CALL R1 1 + 0x78060044, // 000A JMPF R1 #0050 + 0x88040106, // 000B GETMBR R1 R0 K6 + 0x8C040307, // 000C GETMET R1 R1 K7 + 0x880C0108, // 000D GETMBR R3 R0 K8 + 0x7C040400, // 000E CALL R1 2 + 0x58040009, // 000F LDCONST R1 K9 + 0xB80A0200, // 0010 GETNGBL R2 K1 + 0x8C08050A, // 0011 GETMET R2 R2 K10 + 0x7C080200, // 0012 CALL R2 1 + 0x880C010B, // 0013 GETMBR R3 R0 K11 + 0x000C0403, // 0014 ADD R3 R2 R3 + 0x90020603, // 0015 SETMBR R0 K3 R3 + 0x600C000C, // 0016 GETGBL R3 G12 + 0x8810010C, // 0017 GETMBR R4 R0 K12 + 0x7C0C0200, // 0018 CALL R3 1 + 0x140C0203, // 0019 LT R3 R1 R3 + 0x780E0006, // 001A JMPF R3 #0022 + 0x880C010C, // 001B GETMBR R3 R0 K12 + 0x940C0601, // 001C GETIDX R3 R3 R1 + 0x8C0C070D, // 001D GETMET R3 R3 K13 + 0x5C140400, // 001E MOVE R5 R2 + 0x7C0C0400, // 001F CALL R3 2 + 0x0004030E, // 0020 ADD R1 R1 K14 + 0x7001FFF3, // 0021 JMP #0016 + 0x58040009, // 0022 LDCONST R1 K9 + 0x880C0106, // 0023 GETMBR R3 R0 K6 + 0x8810010F, // 0024 GETMBR R4 R0 K15 + 0x6014000C, // 0025 GETGBL R5 G12 + 0x88180110, // 0026 GETMBR R6 R0 K16 + 0x7C140200, // 0027 CALL R5 1 + 0x14140205, // 0028 LT R5 R1 R5 + 0x7816000D, // 0029 JMPF R5 #0038 + 0x8C140907, // 002A GETMET R5 R4 K7 + 0x581C0011, // 002B LDCONST R7 K17 + 0x7C140400, // 002C CALL R5 2 + 0x88140110, // 002D GETMBR R5 R0 K16 + 0x94140A01, // 002E GETIDX R5 R5 R1 + 0x8C140B12, // 002F GETMET R5 R5 K18 + 0x5C1C0800, // 0030 MOVE R7 R4 + 0x7C140400, // 0031 CALL R5 2 + 0x78160002, // 0032 JMPF R5 #0036 + 0x8C140713, // 0033 GETMET R5 R3 K19 + 0x5C1C0800, // 0034 MOVE R7 R4 + 0x7C140400, // 0035 CALL R5 2 + 0x0004030E, // 0036 ADD R1 R1 K14 + 0x7001FFEC, // 0037 JMP #0025 + 0x88140114, // 0038 GETMBR R5 R0 K20 + 0x88180115, // 0039 GETMBR R6 R0 K21 + 0x78160003, // 003A JMPF R5 #003F + 0x781A0002, // 003B JMPF R6 #003F + 0x5C1C0C00, // 003C MOVE R7 R6 + 0x5C200A00, // 003D MOVE R8 R5 + 0x7C1C0200, // 003E CALL R7 1 + 0x8C1C010D, // 003F GETMET R7 R0 K13 + 0x7C1C0200, // 0040 CALL R7 1 + 0x881C0106, // 0041 GETMBR R7 R0 K6 + 0x8C1C0F16, // 0042 GETMET R7 R7 K22 + 0x88240104, // 0043 GETMBR R9 R0 K4 + 0x8C241317, // 0044 GETMET R9 R9 K23 + 0x7C240200, // 0045 CALL R9 1 + 0x88280118, // 0046 GETMBR R10 R0 K24 + 0x882C0104, // 0047 GETMBR R11 R0 K4 + 0x882C1719, // 0048 GETMBR R11 R11 K25 + 0x7C1C0800, // 0049 CALL R7 4 + 0x881C0104, // 004A GETMBR R7 R0 K4 + 0x8C1C0F1A, // 004B GETMET R7 R7 K26 + 0x7C1C0200, // 004C CALL R7 1 + 0x881C0104, // 004D GETMBR R7 R0 K4 + 0x8C1C0F1B, // 004E GETMET R7 R7 K27 + 0x7C1C0200, // 004F CALL R7 1 + 0x80000000, // 0050 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: start +********************************************************************/ +be_local_closure(Leds_animator_start, /* name */ + be_nested_proto( + 6, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str_weak(running), + /* K1 */ be_nested_str_weak(animators), + /* K2 */ be_const_int(0), + /* K3 */ be_nested_str_weak(start), + /* K4 */ be_const_int(1), + /* K5 */ be_nested_str_weak(fast_loop_next), + /* K6 */ be_nested_str_weak(tasmota), + /* K7 */ be_nested_str_weak(add_fast_loop), + /* K8 */ be_nested_str_weak(fast_loop_cb), + }), + be_str_weak(start), + &be_const_str_solidified, + ( &(const binstruction[20]) { /* code */ + 0x50040200, // 0000 LDBOOL R1 1 0 + 0x90020001, // 0001 SETMBR R0 K0 R1 + 0x88040101, // 0002 GETMBR R1 R0 K1 + 0x58080002, // 0003 LDCONST R2 K2 + 0x600C000C, // 0004 GETGBL R3 G12 + 0x5C100200, // 0005 MOVE R4 R1 + 0x7C0C0200, // 0006 CALL R3 1 + 0x140C0403, // 0007 LT R3 R2 R3 + 0x780E0004, // 0008 JMPF R3 #000E + 0x940C0202, // 0009 GETIDX R3 R1 R2 + 0x8C0C0703, // 000A GETMET R3 R3 K3 + 0x7C0C0200, // 000B CALL R3 1 + 0x00080504, // 000C ADD R2 R2 K4 + 0x7001FFF5, // 000D JMP #0004 + 0x90020B02, // 000E SETMBR R0 K5 K2 + 0xB80E0C00, // 000F GETNGBL R3 K6 + 0x8C0C0707, // 0010 GETMET R3 R3 K7 + 0x88140108, // 0011 GETMBR R5 R0 K8 + 0x7C0C0400, // 0012 CALL R3 2 + 0x80000000, // 0013 RET 0 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified class: Leds_animator ********************************************************************/ be_local_class(Leds_animator, - 5, + 13, NULL, - be_nested_map(15, + be_nested_map(28, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_weak(init, 12), be_const_closure(Leds_animator_init_closure) }, - { be_const_key_weak(clear, -1), be_const_closure(Leds_animator_clear_closure) }, - { be_const_key_weak(stop, 13), be_const_closure(Leds_animator_stop_closure) }, - { be_const_key_weak(add_anim, 4), be_const_closure(Leds_animator_add_anim_closure) }, - { be_const_key_weak(pixel_count, 6), be_const_var(1) }, - { be_const_key_weak(animate, -1), be_const_closure(Leds_animator_animate_closure) }, - { be_const_key_weak(animators, 7), be_const_var(4) }, - { be_const_key_weak(strip, -1), be_const_var(0) }, - { be_const_key_weak(bri, -1), be_const_var(2) }, - { be_const_key_weak(remove, 8), be_const_closure(Leds_animator_remove_closure) }, - { be_const_key_weak(get_bri, -1), be_const_closure(Leds_animator_get_bri_closure) }, - { be_const_key_weak(start, -1), be_const_closure(Leds_animator_start_closure) }, - { be_const_key_weak(running, -1), be_const_var(3) }, + { be_const_key_weak(bri, 23), be_const_var(2) }, + { be_const_key_weak(remove, -1), be_const_closure(Leds_animator_remove_closure) }, + { be_const_key_weak(start, 21), be_const_closure(Leds_animator_start_closure) }, { be_const_key_weak(fast_loop, -1), be_const_closure(Leds_animator_fast_loop_closure) }, - { be_const_key_weak(set_bri, 1), be_const_closure(Leds_animator_set_bri_closure) }, + { be_const_key_weak(add_animator, -1), be_const_closure(Leds_animator_add_animator_closure) }, + { be_const_key_weak(FAST_LOOP_MIN, 8), be_const_int(20) }, + { be_const_key_weak(animate, -1), be_const_closure(Leds_animator_animate_closure) }, + { be_const_key_weak(pixel_count, -1), be_const_var(1) }, + { be_const_key_weak(animators, -1), be_const_var(4) }, + { be_const_key_weak(back_color, 11), be_const_var(12) }, + { be_const_key_weak(fast_loop_cb, 12), be_const_var(6) }, + { be_const_key_weak(frame, -1), be_const_var(10) }, + { be_const_key_weak(animate_object, -1), be_const_var(8) }, + { be_const_key_weak(stop, -1), be_const_closure(Leds_animator_stop_closure) }, + { be_const_key_weak(init, -1), be_const_closure(Leds_animator_init_closure) }, + { be_const_key_weak(set_cb, 13), be_const_closure(Leds_animator_set_cb_closure) }, + { be_const_key_weak(running, -1), be_const_var(3) }, + { be_const_key_weak(strip, 15), be_const_var(0) }, + { be_const_key_weak(fast_loop_next, -1), be_const_var(7) }, + { be_const_key_weak(set_back_color, 14), be_const_closure(Leds_animator_set_back_color_closure) }, + { be_const_key_weak(add_painter, -1), be_const_closure(Leds_animator_add_painter_closure) }, + { be_const_key_weak(set_bri, 24), be_const_closure(Leds_animator_set_bri_closure) }, + { be_const_key_weak(layer, 9), be_const_var(11) }, + { be_const_key_weak(animate_method, 6), be_const_var(9) }, + { be_const_key_weak(get_bri, -1), be_const_closure(Leds_animator_get_bri_closure) }, + { be_const_key_weak(painters, -1), be_const_var(5) }, + { be_const_key_weak(clear, 3), be_const_closure(Leds_animator_clear_closure) }, + { be_const_key_weak(add_background_animator, 2), be_const_closure(Leds_animator_add_background_animator_closure) }, })), be_str_weak(Leds_animator) ); diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_frame_be_methods.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_frame_be_methods.h new file mode 100644 index 000000000..7a565f9f2 --- /dev/null +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_frame_be_methods.h @@ -0,0 +1,186 @@ +/* Solidification of leds_frame_be_methods.h */ +/********************************************************************\ +* Generated code, don't edit * +\********************************************************************/ +#include "be_constobj.h" + +extern const bclass be_class_Leds_frame_be; + +/******************************************************************** +** Solidified function: setitem +********************************************************************/ +be_local_closure(Leds_frame_be_setitem, /* name */ + be_nested_proto( + 8, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(set), + }), + &be_const_str_setitem, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x8C0C0100, // 0000 GETMET R3 R0 K0 + 0x54160003, // 0001 LDINT R5 4 + 0x08140205, // 0002 MUL R5 R1 R5 + 0x5C180400, // 0003 MOVE R6 R2 + 0x541E0003, // 0004 LDINT R7 4 + 0x7C0C0800, // 0005 CALL R3 4 + 0x80000000, // 0006 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_pixel +********************************************************************/ +be_local_closure(Leds_frame_be_set_pixel, /* name */ + be_nested_proto( + 11, /* nstack */ + 6, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_nested_str(setitem), + }), + &be_const_str_set_pixel, + &be_const_str_solidified, + ( &(const binstruction[26]) { /* code */ + 0x4C180000, // 0000 LDNIL R6 + 0x1C180A06, // 0001 EQ R6 R5 R6 + 0x781A0000, // 0002 JMPF R6 #0004 + 0x58140000, // 0003 LDCONST R5 K0 + 0x541A00FE, // 0004 LDINT R6 255 + 0x2C180A06, // 0005 AND R6 R5 R6 + 0x541E0017, // 0006 LDINT R7 24 + 0x38180C07, // 0007 SHL R6 R6 R7 + 0x541E00FE, // 0008 LDINT R7 255 + 0x2C1C0407, // 0009 AND R7 R2 R7 + 0x5422000F, // 000A LDINT R8 16 + 0x381C0E08, // 000B SHL R7 R7 R8 + 0x30180C07, // 000C OR R6 R6 R7 + 0x541E00FE, // 000D LDINT R7 255 + 0x2C1C0607, // 000E AND R7 R3 R7 + 0x54220007, // 000F LDINT R8 8 + 0x381C0E08, // 0010 SHL R7 R7 R8 + 0x30180C07, // 0011 OR R6 R6 R7 + 0x541E00FE, // 0012 LDINT R7 255 + 0x2C1C0807, // 0013 AND R7 R4 R7 + 0x30180C07, // 0014 OR R6 R6 R7 + 0x8C1C0101, // 0015 GETMET R7 R0 K1 + 0x5C240200, // 0016 MOVE R9 R1 + 0x5C280C00, // 0017 MOVE R10 R6 + 0x7C1C0600, // 0018 CALL R7 3 + 0x80000000, // 0019 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: item +********************************************************************/ +be_local_closure(Leds_frame_be_item, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(get), + }), + &be_const_str_item, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x54120003, // 0001 LDINT R4 4 + 0x08100204, // 0002 MUL R4 R1 R4 + 0x54160003, // 0003 LDINT R5 4 + 0x7C080600, // 0004 CALL R2 3 + 0x80040400, // 0005 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Leds_frame_be_init, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_nested_str(pixel_size), + /* K2 */ be_nested_str(init), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0x14080300, // 0000 LT R2 R1 K0 + 0x780A0000, // 0001 JMPF R2 #0003 + 0x44040200, // 0002 NEG R1 R1 + 0x90020201, // 0003 SETMBR R0 K1 R1 + 0x60080003, // 0004 GETGBL R2 G3 + 0x5C0C0000, // 0005 MOVE R3 R0 + 0x7C080200, // 0006 CALL R2 1 + 0x8C080502, // 0007 GETMET R2 R2 K2 + 0x5411FFFB, // 0008 LDINT R4 -4 + 0x08100204, // 0009 MUL R4 R1 R4 + 0x7C080400, // 000A CALL R2 2 + 0x80000000, // 000B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Leds_frame_be +********************************************************************/ +be_local_class(Leds_frame_be, + 0, + NULL, + be_nested_map(4, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(setitem, 1), be_const_closure(Leds_frame_be_setitem_closure) }, + { be_const_key(set_pixel, -1), be_const_closure(Leds_frame_be_set_pixel_closure) }, + { be_const_key(item, -1), be_const_closure(Leds_frame_be_item_closure) }, + { be_const_key(init, -1), be_const_closure(Leds_frame_be_init_closure) }, + })), + (bstring*) &be_const_str_Leds_frame_be +); +/*******************************************************************/ + +void be_load_Leds_frame_be_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Leds_frame_be); + be_setglobal(vm, "Leds_frame_be"); + be_pop(vm, 1); +} +/********************************************************************/ +/* End of solidification */ diff --git a/tasmota/berry/leds/leds_animate_demo_palette_background.be b/tasmota/berry/leds/leds_animate_demo_palette_background.be new file mode 100644 index 000000000..1e1681000 --- /dev/null +++ b/tasmota/berry/leds/leds_animate_demo_palette_background.be @@ -0,0 +1,51 @@ +# +# Example for M5Stack Led Matrix +# 5 x 5 WS2812 +# +import animate +class Background_demo : Leds_animator + static var PALETTE_STANDARD_TAG = bytes( + "40" "FF0000" # red + "40" "FFA500" # orange + "40" "FFFF00" # yellow + "40" "00EE00" # green + "40" "0000FF" # blue + "40" "4B00FF" # indigo + "40" "FF82FF" # violet + "00" "FF0000" # red + ) + + static var PALETTE_RAINBOW_WHITE = bytes( + "50" "FF0000" # red + "30" "FF0000" # red + "50" "FFA500" # orange + "30" "FFA500" # orange + "50" "FFFF00" # yellow + "30" "FFFF00" # yellow + "50" "00FF00" # green + "30" "00FF00" # green + "50" "0000FF" # blue + "30" "0000FF" # blue + "50" "FF00FF" # indigo + "30" "FF00FF" # indigo + "50" "FFFFFF" # white + "30" "FFFFFF" # white + "00" "FF0000" # red + ) + + # duration in seconds + def init(strip, duration) + import animate + super(self).init(strip) + # var pal = animate.palette(self.PALETTE_STANDARD_TAG, duration) + var pal = animate.palette(self.PALETTE_RAINBOW_WHITE, duration) + self.add_background_animator(pal) + end + + def animate() + end +end + +var strip = Leds(5 * 5, gpio.pin(gpio.WS2812, 0)) +var r = Background_demo(strip, 20) +r.start() diff --git a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_leds.ino b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_leds.ino index 249553a87..47d80c98f 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_leds.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_leds.ino @@ -199,22 +199,29 @@ extern "C" { case 9: // # 09 : ClearTo (color:??) -> void { uint32_t rgbw = be_toint(vm, 3); - uint8_t w = (rgbw & 0xFF000000) >> 24; - uint8_t r = (rgbw & 0xFF0000) >> 16; - uint8_t g = (rgbw & 0xFF00) >> 8; - uint8_t b = (rgbw & 0xFF); - if (s_ws2812_grb) s_ws2812_grb->ClearTo(RgbColor(r, g, b)); - if (s_sk6812_grbw) s_sk6812_grbw->ClearTo(RgbwColor(r, g, b, w)); + uint8_t w = (rgbw >> 24) & 0xFF; + uint8_t r = (rgbw >> 16) & 0xFF; + uint8_t g = (rgbw >> 8) & 0xFF; + uint8_t b = (rgbw ) & 0xFF; + if (argc >= 5 && be_isint(vm, 4) && be_isint(vm, 5)) { + uint32_t from = be_toint(vm, 4); + uint32_t len = be_toint(vm, 5); + if (s_ws2812_grb) s_ws2812_grb->ClearTo(RgbColor(r, g, b), from, from + len - 1); + if (s_sk6812_grbw) s_sk6812_grbw->ClearTo(RgbwColor(r, g, b, w), from, from + len - 1); + } else { + if (s_ws2812_grb) s_ws2812_grb->ClearTo(RgbColor(r, g, b)); + if (s_sk6812_grbw) s_sk6812_grbw->ClearTo(RgbwColor(r, g, b, w)); + } } break; case 10: // # 10 : SetPixelColor (idx:int, color:??) -> void { int32_t idx = be_toint(vm, 3); uint32_t rgbw = be_toint(vm, 4); - uint8_t w = (rgbw & 0xFF000000) >> 24; - uint8_t r = (rgbw & 0xFF0000) >> 16; - uint8_t g = (rgbw & 0xFF00) >> 8; - uint8_t b = (rgbw & 0xFF); + uint8_t w = (rgbw >> 24) & 0xFF; + uint8_t r = (rgbw >> 16) & 0xFF; + uint8_t g = (rgbw >> 8) & 0xFF; + uint8_t b = (rgbw ) & 0xFF; if (s_ws2812_grb) s_ws2812_grb->SetPixelColor(idx, RgbColor(r, g, b)); if (s_sk6812_grbw) s_sk6812_grbw->SetPixelColor(idx, RgbwColor(r, g, b, w)); } @@ -242,6 +249,234 @@ extern "C" { } be_raise(vm, kTypeError, nullptr); } +} + +extern "C" { + // Leds.blend_color(color_a:int, color_b:int [, alpha:int]) -> color:int + // + // color_a is 0x..RRGGBB + // color_b is 0xAARRGGBB, AA is transparency (00: opaque, FF: transparent) + // Note: the default is 00 considered opaque, so Transparency = 255 - alpha + // alpha is 0..255, and optional. If present it overrides `AA` from color_b + // Note: alpha `00` is transparent, `FF` is opaque + int32_t be_leds_blend_color(bvm *vm); + int32_t be_leds_blend_color(bvm *vm) { + int32_t top = be_top(vm); // Get the number of arguments + if (top >= 2 && be_isint(vm, 1) && be_isint(vm, 2)) { + uint32_t color_a = be_toint(vm, 1); + uint32_t color_b = be_toint(vm, 2); + uint32_t transpency = (color_b >> 24) & 0xFF; + if (top >= 3 && be_isint(vm, 3)) { + transpency = 255 - be_toint(vm, 3); + } + // remove any transparency + color_a = color_a & 0xFFFFFF; + color_b = color_b & 0xFFFFFF; + + if (transpency == 0) { // color_b is opaque, return color_b + be_pushint(vm, color_b); + be_return(vm); + } + if (transpency >= 255) { // color_b is transparent, return color_a + be_pushint(vm, color_a); + be_return(vm); + } + int32_t r = changeUIntScale(transpency, 0, 255, (color_b >> 16) & 0xFF, (color_a >> 16) & 0xFF); + int32_t g = changeUIntScale(transpency, 0, 255, (color_b >> 8) & 0xFF, (color_a >> 8) & 0xFF); + int32_t b = changeUIntScale(transpency, 0, 255, (color_b ) & 0xFF, (color_a ) & 0xFF); + uint32_t rgb = (r << 16) | (g << 8) | b; + be_pushint(vm, rgb); + be_return(vm); + } + be_raise(vm, kTypeError, nullptr); + } + + static uint32_t ApplyBriGamma(uint32_t color_a /* 0xRRGGBB */, uint32_t bri /* 0..100 */, bool gamma) { + if (bri == 0) { return 0x000000; } // if bri is zero, short-cut + uint32_t r = (color_a >> 16) & 0xFF; + uint32_t g = (color_a >> 8) & 0xFF; + uint32_t b = (color_a ) & 0xFF; + + if (bri < 100) { // apply bri + r = changeUIntScale(bri, 0, 100, 0, r); + g = changeUIntScale(bri, 0, 100, 0, g); + b = changeUIntScale(bri, 0, 100, 0, b); + } + + if (gamma) { // apply gamma + r = ledGamma(r); + g = ledGamma(g); + b = ledGamma(b); + } + uint32_t rgb = (r << 16) | (g << 8) | b; + return rgb; + } + + // Leds.apply_bri_gamma(color_rgb:int (0xRRGGBB) [bri:int (0..100), gamma:bool]) -> color:int (0xRRGGBB) + // + int32_t be_leds_apply_bri_gamma(bvm *vm); + int32_t be_leds_apply_bri_gamma(bvm *vm) { + int32_t top = be_top(vm); // Get the number of arguments + if (top >= 1 && be_isint(vm, 1)) { + uint32_t color_a = be_toint(vm, 1); + uint32_t bri = 100; + if (top >= 2 && be_isint(vm, 2)) { + bri = be_toint(vm, 2); + } + bool gamma = false; + if (top >= 3) { + gamma = be_tobool(vm, 3); + } + + uint32_t rgb = ApplyBriGamma(color_a, bri, gamma); + + be_pushint(vm, rgb); + be_return(vm); + } + be_raise(vm, kTypeError, nullptr); + } + + // Leds_frame.blend(color1:int, color2:int, alpha:int) -> int + // + int32_t be_leds_blend(bvm *vm); + int32_t be_leds_blend(bvm *vm) { + int32_t top = be_top(vm); // Get the number of arguments + if (top >= 3 && be_isint(vm, 1) && be_isint(vm, 2) && be_isint(vm, 3)) { + uint32_t color_a = be_toint(vm, 1); + uint32_t color_b = be_toint(vm, 2); + uint32_t alpha = be_toint(vm, 3); + uint32_t r = (color_a >> 16) & 0xFF; + uint32_t g = (color_a >> 8) & 0xFF; + uint32_t b = (color_a ) & 0xFF; + uint32_t r2 = (color_b >> 16) & 0xFF; + uint32_t g2 = (color_b >> 8) & 0xFF; + uint32_t b2 = (color_b ) & 0xFF; + uint32_t r3 = changeUIntScale(alpha, 0, 255, r2, r); + uint32_t g3 = changeUIntScale(alpha, 0, 255, g2, g); + uint32_t b3 = changeUIntScale(alpha, 0, 255, b2, b); + uint32_t rgb = (r3 << 16) | (g3 << 8) | b3; + be_pushint(vm, rgb); + be_return(vm); + } + be_raise(vm, kTypeError, nullptr); + } + + // Leds_frame.blend_pixels(dest:bytes(), foreground:bytes) -> nil + // Destination can be the same as foreground or background + // + // All calculation are done in `0xAARRGGBB` format, AA=0 if opaque (i.e. ignored) + // Background has always alpha = 0 (any other value is ignored) - for simplification + // Size is truncated to smallest of all 3 buffers + int32_t be_leds_blend_pixels(bvm *vm); + int32_t be_leds_blend_pixels(bvm *vm) { + int32_t top = be_top(vm); // Get the number of arguments + if (top >= 2 && be_isbytes(vm, 2)) { + size_t dest_len = 0; + uint32_t * dest_buf = (uint32_t*) be_tobytes(vm, 1, &dest_len); + // back = dest for now, could be changed in the future + size_t back_len = 0; + const uint32_t * back_buf = (const uint32_t*) be_tobytes(vm, 1, &back_len); + size_t fore_len = 0; + const uint32_t * fore_buf = (const uint32_t*) be_tobytes(vm, 2, &fore_len); + + if (fore_len < dest_len) { dest_len = fore_len; } + if (back_len < dest_len) { dest_len = back_len; } + size_t pixels_count = dest_len / 4; + if (pixels_count > 0) { + uint32_t * dest = (uint32_t *)dest_buf; + uint32_t * back = (uint32_t *)back_buf; + uint32_t * fore = (uint32_t *)fore_buf; + for (size_t i = 0; i < pixels_count; i++) { + uint32_t back_argb = back[i]; + uint32_t fore_argb = fore[i]; + uint32_t fore_alpha = (fore_argb >> 24) & 0xFF; + uint32_t dest_rgb_new = back_argb; + if (fore_alpha == 0) { // opaque layer, copy value from fore + dest_rgb_new = fore_argb; + } else if (fore_alpha == 255) { // fore is transparent, use back + // nothing to do, dest_rgb_new = back_argb above + } else { + uint32_t back_r = (back_argb >> 16) & 0xFF; + uint32_t fore_r = (fore_argb >> 16) & 0xFF; + uint32_t back_g = (back_argb >> 8) & 0xFF; + uint32_t fore_g = (fore_argb >> 8) & 0xFF; + uint32_t back_b = (back_argb ) & 0xFF; + uint32_t fore_b = (fore_argb ) & 0xFF; + uint32_t dest_r_new = changeUIntScale(fore_alpha, 0, 255, fore_r, back_r); + uint32_t dest_g_new = changeUIntScale(fore_alpha, 0, 255, fore_g, back_g); + uint32_t dest_b_new = changeUIntScale(fore_alpha, 0, 255, fore_b, back_b); + dest_rgb_new = (dest_r_new << 16) | (dest_g_new << 8) | dest_b_new; + } + dest[i] = dest_rgb_new; + } + } + be_return_nil(vm); + } + be_raise(vm, kTypeError, nullptr); + } + + // Leds_frame.fill_pixels(dest:bytes(), color:int) -> nil + // + // Fill buffer with same color + int32_t be_leds_fill_pixels(bvm *vm); + int32_t be_leds_fill_pixels(bvm *vm) { + int32_t top = be_top(vm); // Get the number of arguments + if (top >= 2 && be_isint(vm, 2)) { + size_t dest_len = 0; + uint32_t * dest_buf = (uint32_t*) be_tobytes(vm, 1, &dest_len); + uint32_t color = be_toint(vm, 2); + + size_t pixels_count = dest_len / 4; + if (pixels_count > 0) { + uint32_t * dest = (uint32_t *)dest_buf; + for (size_t i = 0; i < pixels_count; i++) { + dest[i] = color; + } + } + be_return_nil(vm); + } + be_raise(vm, kTypeError, nullptr); + } + + // Leds_frame.paste_pixels(neopixel:bytes(), led_buffer:bytes(), bri:int 0..100, gamma:bool) + // + // Copy from ARGB buffer to GRB + int32_t be_leds_paste_pixels(bvm *vm); + int32_t be_leds_paste_pixels(bvm *vm) { + int32_t top = be_top(vm); // Get the number of arguments + if (top >= 2 && be_isbytes(vm, 2)) { + size_t src_len = 0; + uint32_t * src_buf = (uint32_t*) be_tobytes(vm, 1, &src_len); + size_t dest_len = 0; + uint8_t * dest_buf = (uint8_t*) be_tobytes(vm, 2, &dest_len); + + uint32_t bri = 100; + if (top >= 3 && be_isint(vm, 3)) { + bri = be_toint(vm, 3); + } + bool gamma = false; + if (top >= 4 && be_isbool(vm, 4)) { + gamma = be_tobool(vm, 4); + } + + size_t pixels_count = src_len / 4; + if (pixels_count > dest_len / 3) { pixels_count = dest_len / 3; } + if (pixels_count > 0) { + for (size_t i = 0; i < pixels_count; i++) { + uint32_t src_argb = ApplyBriGamma(src_buf[i], bri, gamma); + uint32_t src_r = (src_argb >> 16) & 0xFF; + uint32_t src_g = (src_argb >> 8) & 0xFF; + uint32_t src_b = (src_argb ) & 0xFF; + dest_buf[i * 3 + 0] = src_g; + dest_buf[i * 3 + 1] = src_r; + dest_buf[i * 3 + 2] = src_b; + } + } + be_return_nil(vm); + } + be_raise(vm, kTypeError, nullptr); + } + }