From fbc827d11d0a6ed03e13dff0b389ac2a5a70676c Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Fri, 22 Dec 2023 18:10:34 +0100 Subject: [PATCH] Berry fix leds brightness (#20292) --- .../berry_tasmota/src/be_animate_module.c | 23 +- .../berry_tasmota/src/embedded/animate_0.be | 3 + .../{animate_0_core.be => animate_1_core.be} | 12 +- ...ffects.be => animate_2_animate_effects.be} | 7 +- .../src/embedded/animate_9_module.be | 23 +- .../berry_tasmota/src/embedded/leds.be | 26 + .../src/solidify/solidified_animate_0.h | 7 + ...e_0_core.h => solidified_animate_1_core.h} | 902 ++++++----- ...=> solidified_animate_2_animate_effects.h} | 2 +- .../solidify/solidified_animate_9_module.h | 162 +- .../src/solidify/solidified_leds.h | 1375 +++++++++-------- .../berry/animate_demo/animate_demo_pulse.be | 3 +- .../xdrv_52_3_berry_leds.ino | 24 +- 13 files changed, 1401 insertions(+), 1168 deletions(-) create mode 100644 lib/libesp32/berry_tasmota/src/embedded/animate_0.be rename lib/libesp32/berry_tasmota/src/embedded/{animate_0_core.be => animate_1_core.be} (92%) rename lib/libesp32/berry_tasmota/src/embedded/{animate_1_animate_effects.be => animate_2_animate_effects.be} (97%) create mode 100644 lib/libesp32/berry_tasmota/src/solidify/solidified_animate_0.h rename lib/libesp32/berry_tasmota/src/solidify/{solidified_animate_0_core.h => solidified_animate_1_core.h} (83%) rename lib/libesp32/berry_tasmota/src/solidify/{solidified_animate_1_animate_effects.h => solidified_animate_2_animate_effects.h} (99%) diff --git a/lib/libesp32/berry_tasmota/src/be_animate_module.c b/lib/libesp32/berry_tasmota/src/be_animate_module.c index d638cbb79..3c920e6be 100644 --- a/lib/libesp32/berry_tasmota/src/be_animate_module.c +++ b/lib/libesp32/berry_tasmota/src/be_animate_module.c @@ -24,8 +24,8 @@ #include "be_constobj.h" #include "be_mapping.h" -#include "solidify/solidified_animate_0_core.h" -#include "solidify/solidified_animate_1_animate_effects.h" +#include "solidify/solidified_animate_1_core.h" +#include "solidify/solidified_animate_2_animate_effects.h" #include "solidify/solidified_animate_9_module.h" @@ -154,7 +154,6 @@ module animate (scope: global, strings: weak) { TRIANGLE, int(2) SQUARE, int(3) COSINE, int(4) - SINE, int(5) LASTFORM, int(5) PALETTE_STANDARD_TAG, comptr(PALETTE_STANDARD_TAG) @@ -182,14 +181,14 @@ module animate (scope: global, strings: weak) { import animate var p, gradient p = animate.palette.ptr_to_palette(animate.PALETTE_STANDARD_TAG) -assert(p == bytes('40FF000040FFA50040FFFF004000FF00400000FF40FF00FF40FFFFFF00FF0000')) +assert(p == bytes('40FF000040FFA50040FFFF004000FF00400000FF40FF00FF40EE44A500FF0000')) gradient = animate.palette.to_css_gradient(p) -assert(gradient == 'background:linear-gradient(to right,#FF0000 0.0%,#FFA500 14.3%,#FFFF00 28.6%,#00FF00 42.9%,#0000FF 57.1%,#FF00FF 71.4%,#FFFFFF 85.7%,#FF0000 100.0%);') +assert(gradient == 'background:linear-gradient(to right,#FF0000 0.0%,#FFA500 14.3%,#FFFF00 28.6%,#00FF00 42.9%,#0000FF 57.1%,#FF00FF 71.4%,#EE44A5 85.7%,#FF0000 100.0%);') p = animate.palette.ptr_to_palette(animate.PALETTE_STANDARD_VAL) -assert(p == bytes('00FF000024FFA50049FFFF006E00FF00920000FFB7FF00FFDBFFFFFFFFFF0000')) +assert(p == bytes('00FF00002AFFA50055FFFF007F00FF00AA0000FFD4FF00FFFFFF0000')) gradient = animate.palette.to_css_gradient(animate.PALETTE_STANDARD_VAL) -assert(gradient == 'background:linear-gradient(to right,#FF0000 0.0%,#FFA500 14.1%,#FFFF00 28.6%,#00FF00 43.1%,#0000FF 57.3%,#FF00FF 71.8%,#FFFFFF 85.9%,#FF0000 100.0%);') +assert(gradient == 'background:linear-gradient(to right,#FF0000 0.0%,#FFA500 16.5%,#FFFF00 33.3%,#00FF00 49.8%,#0000FF 66.7%,#FF00FF 83.1%,#FF0000 100.0%);') # unit tests @@ -227,16 +226,6 @@ assert(o.animate(6000) == 1000) assert(o.animate(7000) == -1000) assert(o.animate(7100) == -1000) -o = animate.oscillator(-1000, 1000, 6000, animate.SINE) -o.start(1000) -assert(o.animate(1000) == 0) -assert(o.animate(1500) == 500) -assert(o.animate(2000) == 867) -assert(o.animate(2500) == 1000) -assert(o.animate(4000) == 0) -assert(o.animate(5500) == -1000) -assert(o.animate(7000) == 0) - o = animate.oscillator(-1000, 1000, 6000, animate.COSINE) o.start(1000) assert(o.animate(1000) == -1000) diff --git a/lib/libesp32/berry_tasmota/src/embedded/animate_0.be b/lib/libesp32/berry_tasmota/src/embedded/animate_0.be new file mode 100644 index 000000000..5c854f6e1 --- /dev/null +++ b/lib/libesp32/berry_tasmota/src/embedded/animate_0.be @@ -0,0 +1,3 @@ +# prepare for module `animate` + +global.animate = module('animate') \ No newline at end of file diff --git a/lib/libesp32/berry_tasmota/src/embedded/animate_0_core.be b/lib/libesp32/berry_tasmota/src/embedded/animate_1_core.be similarity index 92% rename from lib/libesp32/berry_tasmota/src/embedded/animate_0_core.be rename to lib/libesp32/berry_tasmota/src/embedded/animate_1_core.be index 747376d9d..bacaf561d 100644 --- a/lib/libesp32/berry_tasmota/src/embedded/animate_0_core.be +++ b/lib/libesp32/berry_tasmota/src/embedded/animate_1_core.be @@ -36,6 +36,7 @@ class Animate_core self.strip = strip if (bri == nil) bri = 50 end self.bri = bri # percentage of brightness 0..100 + self.set_strip_bri() self.running = false self.pixel_count = strip.pixel_count() self.animators = [] @@ -51,6 +52,10 @@ class Animate_core self.set_current() end + def set_strip_bri() + self.strip.set_bri(tasmota.scale_uint(self.bri, 0, 100, 0, 255)) + end + # set this animate.core as the current animator for configuration def set_current() global._cur_anim = self # declare the current animate.core for painters and animators to register @@ -129,6 +134,7 @@ class Animate_core def set_bri(bri) self.bri = bri + self.set_strip_bri() end def get_bri(bri) return self.bri @@ -165,7 +171,10 @@ class Animate_core while i < size(self.painters) layer.fill_pixels(0xFF000000) # fill with transparent color if (self.painters[i].paint(layer)) +# print(f"frame0 {self.frame.tohex()}") +# print(f"layer0 {self.layer.tohex()}") frame.blend_pixels(layer) +# print(f"frame1 {self.frame.tohex()}") end i += 1 end @@ -177,7 +186,7 @@ class Animate_core end self.animate() # now display the frame - self.frame.paste_pixels(self.strip.pixels_buffer(), self.bri, self.strip.gamma) + self.frame.paste_pixels(self.strip.pixels_buffer(), self.strip.get_bri(), self.strip.get_gamma()) self.strip.dirty() self.strip.show() end @@ -192,3 +201,4 @@ class Animate_core tasmota.remove_fast_loop(self.fast_loop_cb) end end +animate.core = global.Animate_core diff --git a/lib/libesp32/berry_tasmota/src/embedded/animate_1_animate_effects.be b/lib/libesp32/berry_tasmota/src/embedded/animate_2_animate_effects.be similarity index 97% rename from lib/libesp32/berry_tasmota/src/embedded/animate_1_animate_effects.be rename to lib/libesp32/berry_tasmota/src/embedded/animate_2_animate_effects.be index a059ee85c..d2653db67 100644 --- a/lib/libesp32/berry_tasmota/src/embedded/animate_1_animate_effects.be +++ b/lib/libesp32/berry_tasmota/src/embedded/animate_2_animate_effects.be @@ -19,6 +19,7 @@ class Animate_painter end end +animate.painter = global.Animate_painter ########################################################################################## # @@ -144,8 +145,8 @@ class Animate_pulse : Animate_painter return true end - end +animate.pulse = global.Animate_pulse # # Unit tests @@ -156,8 +157,8 @@ import animate var frame = animate.frame(10) assert(frame.tohex() == '00000000000000000000000000000000000000000000000000000000000000000000000000000000') -var pulse = Animate_pulse(0x00FF00, 3, 2) -pulse.set_index(5) +var pulse = animate.pulse(0x00FF00, 3, 2) +pulse.set_pos(5) pulse.paint(frame) assert(frame.tohex() == '0000000000000000000000000055000000AA000000FF000000FF000000FF000000AA000000550000') diff --git a/lib/libesp32/berry_tasmota/src/embedded/animate_9_module.be b/lib/libesp32/berry_tasmota/src/embedded/animate_9_module.be index 46fdcb16f..6991f0fde 100644 --- a/lib/libesp32/berry_tasmota/src/embedded/animate_9_module.be +++ b/lib/libesp32/berry_tasmota/src/embedded/animate_9_module.be @@ -4,15 +4,6 @@ # Animation framework # -animate = module("animate") - -# for solidification -class Leds_frame end - -animate.("()") = Animate_core # make it available as `animate()` -animate.frame = Leds_frame -animate.pulse = Animate_pulse - ################################################################################# # class Animate_palette # @@ -85,7 +76,6 @@ animate.pulse = Animate_pulse # ) # # animate.PALETTE_STANDARD = PALETTE_STANDARD - #@ solidify:Animate_animator,weak class Animate_animator # timing information @@ -134,6 +124,7 @@ class Animate_animator end end +animate.animator = Animate_animator #@ solidify:Animate_palette,weak class Animate_palette : Animate_animator @@ -408,7 +399,6 @@ animate.SAWTOOTH = 1 animate.TRIANGLE = 2 animate.SQUARE = 3 animate.COSINE = 4 -animate.SINE = 5 animate.LASTFOMR = 5 # identify last form #@ solidify:Animate_oscillator,weak @@ -471,7 +461,7 @@ class Animate_oscillator : Animate_animator var past = millis - self.origin if past < 0 past = 0 - millis = self.originally + millis = self.origin end var duration_ms = self.duration_ms var duration_ms_mid # mid point considering duty cycle @@ -506,13 +496,10 @@ class Animate_oscillator : Animate_animator else value = b end - elif (self.form == 4) #-COSINE-# || (self.form == 5) #-SINE-# + elif (self.form == 4) #-COSINE-# # map timing to 0..32767 var angle = tasmota.scale_int(past_with_phase, 0, duration_ms - 1, 0, 32767) - if (self.form == 4) #-COSINE-# - angle -= 8192 - end - var x = tasmota.sine_int(angle) # -4096 .. 4096 + var x = tasmota.sine_int(angle - 8192) # -4096 .. 4096, dephase from cosine to sine value = tasmota.scale_int(x, -4096, 4096, a, b) end self.value = value @@ -526,4 +513,4 @@ class Animate_oscillator : Animate_animator return value end end -animate.oscillator = Animate_oscillator +global.animate.oscillator = Animate_oscillator diff --git a/lib/libesp32/berry_tasmota/src/embedded/leds.be b/lib/libesp32/berry_tasmota/src/embedded/leds.be index 3e20b1c4a..1d9e505ac 100644 --- a/lib/libesp32/berry_tasmota/src/embedded/leds.be +++ b/lib/libesp32/berry_tasmota/src/embedded/leds.be @@ -27,6 +27,7 @@ class Leds_ntv end class Leds : Leds_ntv var gamma # if true, apply gamma (true is default) var leds # number of leds + var bri # implicit brightness for this led strip (0..255, default is 50% = 127) # leds:int = number of leds of the strip # gpio:int (optional) = GPIO for NeoPixel. If not specified, takes the WS2812 gpio # typ:int (optional) = Type of LED, defaults to WS2812 RGB @@ -34,6 +35,7 @@ class Leds : Leds_ntv def init(leds, gpio_phy, typ, rmt) # rmt is optional self.gamma = true # gamma is enabled by default, it should be disabled explicitly if needed self.leds = int(leds) + self.bri = 127 # 50% brightness by default # if no GPIO, abort if gpio_phy == nil @@ -93,6 +95,16 @@ class Leds : Leds_ntv self.show() end + # set bri (0..255) + def set_bri(bri) + if (bri < 0) bri = 0 end + if (bri > 255) bri = 255 end + self.bri = bri + end + def get_bri() + return self.bri + end + def ctor(leds, gpio_phy, typ, rmt) if typ == nil typ = self.WS2812_GRB @@ -136,14 +148,22 @@ class Leds : Leds_ntv return 0 end def clear_to(col, bri) + if (bri == nil) bri = self.bri end self.call_native(9, self.to_gamma(col, bri)) end def set_pixel_color(idx, col, bri) + if (bri == nil) bri = self.bri end self.call_native(10, idx, self.to_gamma(col, bri)) end def get_pixel_color(idx) return self.call_native(11, idx) end + def set_gamma(gamma) + self.gamma = bool(gamma) + end + def get_gamma() + return self.gamma + end # def rotate_left(rot, first, last) # self.call_native(20, rot, first, last) # end @@ -159,6 +179,7 @@ class Leds : Leds_ntv # apply gamma and bri def to_gamma(rgb, bri) + if (bri == nil) bri = self.bri end return self.apply_bri_gamma(rgb, bri, self.gamma) end @@ -216,6 +237,7 @@ class Leds : Leds_ntv return self.leds end def clear_to(col, bri) + if (bri == nil) bri = self.bri end self.strip.call_native(9, self.strip.to_gamma(col, bri), self.offset, self.leds) # var i = 0 # while i < self.leds @@ -224,6 +246,7 @@ class Leds : Leds_ntv # end end def set_pixel_color(idx, col, bri) + if (bri == nil) bri = self.bri end self.strip.set_pixel_color(idx + self.offset, col, bri) end def get_pixel_color(idx) @@ -301,9 +324,11 @@ class Leds : Leds_ntv return self.offset end def clear_to(col, bri) + if (bri == nil) bri = self.bri 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) + if (bri == nil) bri = self.bri end self.strip.set_pixel_color(idx + self.offset, col, bri) end def get_pixel_color(idx) @@ -328,6 +353,7 @@ class Leds : Leds_ntv end def set_matrix_pixel_color(x, y, col, bri) + if (bri == nil) bri = self.bri end if self.alternate && x % 2 # reversed line self.strip.set_pixel_color(x * self.w + self.h - y - 1 + self.offset, col, bri) diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_0.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_0.h new file mode 100644 index 000000000..a0a262928 --- /dev/null +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_0.h @@ -0,0 +1,7 @@ +/* Solidification of animate_0.h */ +/********************************************************************\ +* Generated code, don't edit * +\********************************************************************/ +#include "be_constobj.h" +/********************************************************************/ +/* End of solidification */ diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_0_core.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_1_core.h similarity index 83% rename from lib/libesp32/berry_tasmota/src/solidify/solidified_animate_0_core.h rename to lib/libesp32/berry_tasmota/src/solidify/solidified_animate_1_core.h index cc86ccf2e..280b7de5c 100644 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_0_core.h +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_1_core.h @@ -1,4 +1,4 @@ -/* Solidification of animate_0_core.h */ +/* Solidification of animate_1_core.h */ /********************************************************************\ * Generated code, don't edit * \********************************************************************/ @@ -7,11 +7,11 @@ extern const bclass be_class_Animate_core; /******************************************************************** -** Solidified function: start +** Solidified function: clear ********************************************************************/ -be_local_closure(Animate_core_start, /* name */ +be_local_closure(Animate_core_clear, /* name */ be_nested_proto( - 6, /* nstack */ + 3, /* nstack */ 1, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -19,110 +19,62 @@ be_local_closure(Animate_core_start, /* name */ 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 function: remove -********************************************************************/ -be_local_closure(Animate_core_remove, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(clear), - /* K1 */ be_nested_str_weak(tasmota), - /* K2 */ be_nested_str_weak(remove_fast_loop), - /* K3 */ be_nested_str_weak(fast_loop_cb), - }), - be_str_weak(remove), - &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x7C040200, // 0001 CALL R1 1 - 0xB8060200, // 0002 GETNGBL R1 K1 - 0x8C040302, // 0003 GETMET R1 R1 K2 - 0x880C0103, // 0004 GETMBR R3 R0 K3 - 0x7C040400, // 0005 CALL R1 2 - 0x80000000, // 0006 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: add_background_animator -********************************************************************/ -be_local_closure(Animate_core_add_background_animator, /* name */ - be_nested_proto( - 6, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str_weak(set_cb), - /* K1 */ be_nested_str_weak(set_back_color), - /* K2 */ be_nested_str_weak(add_animator), + /* K0 */ be_nested_str_weak(stop), + /* K1 */ be_nested_str_weak(strip), + /* K2 */ be_nested_str_weak(clear), }), - be_str_weak(add_background_animator), + be_str_weak(clear), &be_const_str_solidified, - ( &(const binstruction[ 8]) { /* code */ - 0x8C080300, // 0000 GETMET R2 R1 K0 - 0x5C100000, // 0001 MOVE R4 R0 - 0x88140101, // 0002 GETMBR R5 R0 K1 - 0x7C080600, // 0003 CALL R2 3 - 0x8C080102, // 0004 GETMET R2 R0 K2 - 0x5C100200, // 0005 MOVE R4 R1 - 0x7C080400, // 0006 CALL R2 2 - 0x80000000, // 0007 RET 0 + ( &(const binstruction[ 6]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x7C040200, // 0001 CALL R1 1 + 0x88040101, // 0002 GETMBR R1 R0 K1 + 0x8C040302, // 0003 GETMET R1 R1 K2 + 0x7C040200, // 0004 CALL R1 1 + 0x80000000, // 0005 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_strip_bri +********************************************************************/ +be_local_closure(Animate_core_set_strip_bri, /* name */ + be_nested_proto( + 10, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str_weak(strip), + /* K1 */ be_nested_str_weak(set_bri), + /* K2 */ be_nested_str_weak(tasmota), + /* K3 */ be_nested_str_weak(scale_uint), + /* K4 */ be_nested_str_weak(bri), + /* K5 */ be_const_int(0), + }), + be_str_weak(set_strip_bri), + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0xB80E0400, // 0002 GETNGBL R3 K2 + 0x8C0C0703, // 0003 GETMET R3 R3 K3 + 0x88140104, // 0004 GETMBR R5 R0 K4 + 0x58180005, // 0005 LDCONST R6 K5 + 0x541E0063, // 0006 LDINT R7 100 + 0x58200005, // 0007 LDCONST R8 K5 + 0x542600FE, // 0008 LDINT R9 255 + 0x7C0C0C00, // 0009 CALL R3 6 + 0x7C040400, // 000A CALL R1 2 + 0x80000000, // 000B RET 0 }) ) ); @@ -170,102 +122,6 @@ be_local_closure(Animate_core_remove_painter, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: add_animator -********************************************************************/ -be_local_closure(Animate_core_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[ 3]) { /* constants */ - /* K0 */ be_nested_str_weak(animators), - /* K1 */ be_nested_str_weak(find), - /* K2 */ be_nested_str_weak(push), - }), - be_str_weak(add_animator), - &be_const_str_solidified, - ( &(const binstruction[12]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x5C100200, // 0002 MOVE R4 R1 - 0x7C080400, // 0003 CALL R2 2 - 0x4C0C0000, // 0004 LDNIL R3 - 0x1C080403, // 0005 EQ R2 R2 R3 - 0x780A0003, // 0006 JMPF R2 #000B - 0x88080100, // 0007 GETMBR R2 R0 K0 - 0x8C080502, // 0008 GETMET R2 R2 K2 - 0x5C100200, // 0009 MOVE R4 R1 - 0x7C080400, // 000A CALL R2 2 - 0x80000000, // 000B RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: animate -********************************************************************/ -be_local_closure(Animate_core_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: clear -********************************************************************/ -be_local_closure(Animate_core_clear, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str_weak(stop), - /* K1 */ be_nested_str_weak(strip), - /* K2 */ be_nested_str_weak(clear), - }), - be_str_weak(clear), - &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x7C040200, // 0001 CALL R1 1 - 0x88040101, // 0002 GETMBR R1 R0 K1 - 0x8C040302, // 0003 GETMET R1 R1 K2 - 0x7C040200, // 0004 CALL R1 1 - 0x80000000, // 0005 RET 0 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified function: stop ********************************************************************/ @@ -317,6 +173,63 @@ be_local_closure(Animate_core_stop, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: get_bri +********************************************************************/ +be_local_closure(Animate_core_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(Animate_core_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[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(bri), + /* K1 */ be_nested_str_weak(set_strip_bri), + }), + be_str_weak(set_bri), + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x8C080101, // 0001 GETMET R2 R0 K1 + 0x7C080200, // 0002 CALL R2 1 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified function: add_painter ********************************************************************/ @@ -356,138 +269,12 @@ be_local_closure(Animate_core_add_painter, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: set_bri -********************************************************************/ -be_local_closure(Animate_core_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_current -********************************************************************/ -be_local_closure(Animate_core_set_current, /* 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(global), - /* K1 */ be_nested_str_weak(_cur_anim), - }), - be_str_weak(set_current), - &be_const_str_solidified, - ( &(const binstruction[ 3]) { /* code */ - 0xB8060000, // 0000 GETNGBL R1 K0 - 0x90060200, // 0001 SETMBR R1 K1 R0 - 0x80000000, // 0002 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: remove_animator -********************************************************************/ -be_local_closure(Animate_core_remove_animator, /* 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_weak(animators), - /* K1 */ be_nested_str_weak(remove), - /* K2 */ be_nested_str_weak(find), - /* K3 */ be_nested_str_weak(clear), - }), - be_str_weak(remove_animator), - &be_const_str_solidified, - ( &(const binstruction[13]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x4C0C0000, // 0001 LDNIL R3 - 0x200C0203, // 0002 NE R3 R1 R3 - 0x780E0005, // 0003 JMPF R3 #000A - 0x8C0C0501, // 0004 GETMET R3 R2 K1 - 0x8C140502, // 0005 GETMET R5 R2 K2 - 0x5C1C0200, // 0006 MOVE R7 R1 - 0x7C140400, // 0007 CALL R5 2 - 0x7C0C0400, // 0008 CALL R3 2 - 0x70020001, // 0009 JMP #000C - 0x8C0C0503, // 000A GETMET R3 R2 K3 - 0x7C0C0200, // 000B CALL R3 1 - 0x80000000, // 000C RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_cb -********************************************************************/ -be_local_closure(Animate_core_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(obj), - /* K1 */ be_nested_str_weak(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: fast_loop ********************************************************************/ be_local_closure(Animate_core_fast_loop, /* name */ be_nested_proto( - 12, /* nstack */ + 13, /* nstack */ 1, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -520,25 +307,25 @@ be_local_closure(Animate_core_fast_loop, /* name */ /* K21 */ be_nested_str_weak(mth), /* 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), + /* K24 */ be_nested_str_weak(get_bri), + /* K25 */ be_nested_str_weak(get_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 */ + ( &(const binstruction[84]) { /* code */ 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x7806004D, // 0001 JMPF R1 #0050 + 0x78060050, // 0001 JMPF R1 #0053 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 + 0x7806004B, // 0006 JMPF R1 #0053 0x88040104, // 0007 GETMBR R1 R0 K4 0x8C040305, // 0008 GETMET R1 R1 K5 0x7C040200, // 0009 CALL R1 1 - 0x78060044, // 000A JMPF R1 #0050 + 0x78060047, // 000A JMPF R1 #0053 0x88040106, // 000B GETMBR R1 R0 K6 0x8C040307, // 000C GETMET R1 R1 K7 0x880C0108, // 000D GETMBR R3 R0 K8 @@ -598,17 +385,20 @@ be_local_closure(Animate_core_fast_loop, /* name */ 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 + 0x88280104, // 0046 GETMBR R10 R0 K4 + 0x8C281518, // 0047 GETMET R10 R10 K24 + 0x7C280200, // 0048 CALL R10 1 + 0x882C0104, // 0049 GETMBR R11 R0 K4 + 0x8C2C1719, // 004A GETMET R11 R11 K25 + 0x7C2C0200, // 004B CALL R11 1 + 0x7C1C0800, // 004C CALL R7 4 0x881C0104, // 004D GETMBR R7 R0 K4 - 0x8C1C0F1B, // 004E GETMET R7 R7 K27 + 0x8C1C0F1A, // 004E GETMET R7 R7 K26 0x7C1C0200, // 004F CALL R7 1 - 0x80000000, // 0050 RET 0 + 0x881C0104, // 0050 GETMBR R7 R0 K4 + 0x8C1C0F1B, // 0051 GETMET R7 R7 K27 + 0x7C1C0200, // 0052 CALL R7 1 + 0x80000000, // 0053 RET 0 }) ) ); @@ -616,11 +406,11 @@ be_local_closure(Animate_core_fast_loop, /* name */ /******************************************************************** -** Solidified function: set_back_color +** Solidified function: remove_animator ********************************************************************/ -be_local_closure(Animate_core_set_back_color, /* name */ +be_local_closure(Animate_core_remove_animator, /* name */ be_nested_proto( - 2, /* nstack */ + 8, /* nstack */ 2, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -628,14 +418,81 @@ be_local_closure(Animate_core_set_back_color, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(back_color), + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str_weak(animators), + /* K1 */ be_nested_str_weak(remove), + /* K2 */ be_nested_str_weak(find), + /* K3 */ be_nested_str_weak(clear), }), - be_str_weak(set_back_color), + be_str_weak(remove_animator), &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x90020001, // 0000 SETMBR R0 K0 R1 - 0x80000000, // 0001 RET 0 + ( &(const binstruction[13]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x4C0C0000, // 0001 LDNIL R3 + 0x200C0203, // 0002 NE R3 R1 R3 + 0x780E0005, // 0003 JMPF R3 #000A + 0x8C0C0501, // 0004 GETMET R3 R2 K1 + 0x8C140502, // 0005 GETMET R5 R2 K2 + 0x5C1C0200, // 0006 MOVE R7 R1 + 0x7C140400, // 0007 CALL R5 2 + 0x7C0C0400, // 0008 CALL R3 2 + 0x70020001, // 0009 JMP #000C + 0x8C0C0503, // 000A GETMET R3 R2 K3 + 0x7C0C0200, // 000B CALL R3 1 + 0x80000000, // 000C RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: animate +********************************************************************/ +be_local_closure(Animate_core_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: set_current +********************************************************************/ +be_local_closure(Animate_core_set_current, /* 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(global), + /* K1 */ be_nested_str_weak(_cur_anim), + }), + be_str_weak(set_current), + &be_const_str_solidified, + ( &(const binstruction[ 3]) { /* code */ + 0xB8060000, // 0000 GETNGBL R1 K0 + 0x90060200, // 0001 SETMBR R1 K1 R0 + 0x80000000, // 0002 RET 0 }) ) ); @@ -679,25 +536,26 @@ be_local_closure(Animate_core_init, /* name */ ), }), 1, /* has constants */ - ( &(const bvalue[14]) { /* constants */ + ( &(const bvalue[15]) { /* constants */ /* K0 */ be_nested_str_weak(animate), /* K1 */ be_nested_str_weak(strip), /* K2 */ be_nested_str_weak(bri), - /* K3 */ be_nested_str_weak(running), - /* K4 */ be_nested_str_weak(pixel_count), - /* K5 */ be_nested_str_weak(animators), - /* K6 */ be_nested_str_weak(painters), - /* K7 */ be_nested_str_weak(clear), - /* K8 */ be_nested_str_weak(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), - /* K13 */ be_nested_str_weak(set_current), + /* K3 */ be_nested_str_weak(set_strip_bri), + /* K4 */ be_nested_str_weak(running), + /* K5 */ be_nested_str_weak(pixel_count), + /* K6 */ be_nested_str_weak(animators), + /* K7 */ be_nested_str_weak(painters), + /* K8 */ be_nested_str_weak(clear), + /* K9 */ be_nested_str_weak(frame), + /* K10 */ be_nested_str_weak(layer), + /* K11 */ be_nested_str_weak(fast_loop_cb), + /* K12 */ be_nested_str_weak(back_color), + /* K13 */ be_const_int(0), + /* K14 */ be_nested_str_weak(set_current), }), be_str_weak(init), &be_const_str_solidified, - ( &(const binstruction[35]) { /* code */ + ( &(const binstruction[37]) { /* code */ 0xA40E0000, // 0000 IMPORT R3 K0 0x90020201, // 0001 SETMBR R0 K1 R1 0x4C100000, // 0002 LDNIL R4 @@ -705,34 +563,36 @@ be_local_closure(Animate_core_init, /* name */ 0x78120000, // 0004 JMPF R4 #0006 0x540A0031, // 0005 LDINT R2 50 0x90020402, // 0006 SETMBR R0 K2 R2 - 0x50100000, // 0007 LDBOOL R4 0 0 - 0x90020604, // 0008 SETMBR R0 K3 R4 - 0x8C100304, // 0009 GETMET R4 R1 K4 - 0x7C100200, // 000A CALL R4 1 - 0x90020804, // 000B SETMBR R0 K4 R4 - 0x60100012, // 000C GETGBL R4 G18 - 0x7C100000, // 000D CALL R4 0 - 0x90020A04, // 000E SETMBR R0 K5 R4 - 0x60100012, // 000F GETGBL R4 G18 - 0x7C100000, // 0010 CALL R4 0 - 0x90020C04, // 0011 SETMBR R0 K6 R4 - 0x8C100107, // 0012 GETMET R4 R0 K7 - 0x7C100200, // 0013 CALL R4 1 - 0x8C100708, // 0014 GETMET R4 R3 K8 - 0x88180104, // 0015 GETMBR R6 R0 K4 - 0x7C100400, // 0016 CALL R4 2 - 0x90021004, // 0017 SETMBR R0 K8 R4 - 0x8C100708, // 0018 GETMET R4 R3 K8 - 0x88180104, // 0019 GETMBR R6 R0 K4 - 0x7C100400, // 001A CALL R4 2 - 0x90021204, // 001B SETMBR R0 K9 R4 - 0x84100000, // 001C CLOSURE R4 P0 + 0x8C100103, // 0007 GETMET R4 R0 K3 + 0x7C100200, // 0008 CALL R4 1 + 0x50100000, // 0009 LDBOOL R4 0 0 + 0x90020804, // 000A SETMBR R0 K4 R4 + 0x8C100305, // 000B GETMET R4 R1 K5 + 0x7C100200, // 000C CALL R4 1 + 0x90020A04, // 000D SETMBR R0 K5 R4 + 0x60100012, // 000E GETGBL R4 G18 + 0x7C100000, // 000F CALL R4 0 + 0x90020C04, // 0010 SETMBR R0 K6 R4 + 0x60100012, // 0011 GETGBL R4 G18 + 0x7C100000, // 0012 CALL R4 0 + 0x90020E04, // 0013 SETMBR R0 K7 R4 + 0x8C100108, // 0014 GETMET R4 R0 K8 + 0x7C100200, // 0015 CALL R4 1 + 0x8C100709, // 0016 GETMET R4 R3 K9 + 0x88180105, // 0017 GETMBR R6 R0 K5 + 0x7C100400, // 0018 CALL R4 2 + 0x90021204, // 0019 SETMBR R0 K9 R4 + 0x8C100709, // 001A GETMET R4 R3 K9 + 0x88180105, // 001B GETMBR R6 R0 K5 + 0x7C100400, // 001C CALL R4 2 0x90021404, // 001D SETMBR R0 K10 R4 - 0x9002170C, // 001E SETMBR R0 K11 K12 - 0x8C10010D, // 001F GETMET R4 R0 K13 - 0x7C100200, // 0020 CALL R4 1 - 0xA0000000, // 0021 CLOSE R0 - 0x80000000, // 0022 RET 0 + 0x84100000, // 001E CLOSURE R4 P0 + 0x90021604, // 001F SETMBR R0 K11 R4 + 0x9002190D, // 0020 SETMBR R0 K12 K13 + 0x8C10010E, // 0021 GETMET R4 R0 K14 + 0x7C100200, // 0022 CALL R4 1 + 0xA0000000, // 0023 CLOSE R0 + 0x80000000, // 0024 RET 0 }) ) ); @@ -740,11 +600,40 @@ be_local_closure(Animate_core_init, /* name */ /******************************************************************** -** Solidified function: get_bri +** Solidified function: set_cb ********************************************************************/ -be_local_closure(Animate_core_get_bri, /* name */ +be_local_closure(Animate_core_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(obj), + /* K1 */ be_nested_str_weak(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: set_back_color +********************************************************************/ +be_local_closure(Animate_core_set_back_color, /* name */ + be_nested_proto( + 2, /* nstack */ 2, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -753,13 +642,175 @@ be_local_closure(Animate_core_get_bri, /* name */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(bri), + /* K0 */ be_nested_str_weak(back_color), }), - be_str_weak(get_bri), + 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: add_background_animator +********************************************************************/ +be_local_closure(Animate_core_add_background_animator, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str_weak(set_cb), + /* K1 */ be_nested_str_weak(set_back_color), + /* K2 */ be_nested_str_weak(add_animator), + }), + be_str_weak(add_background_animator), + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x8C080300, // 0000 GETMET R2 R1 K0 + 0x5C100000, // 0001 MOVE R4 R0 + 0x88140101, // 0002 GETMBR R5 R0 K1 + 0x7C080600, // 0003 CALL R2 3 + 0x8C080102, // 0004 GETMET R2 R0 K2 + 0x5C100200, // 0005 MOVE R4 R1 + 0x7C080400, // 0006 CALL R2 2 + 0x80000000, // 0007 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: add_animator +********************************************************************/ +be_local_closure(Animate_core_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[ 3]) { /* constants */ + /* K0 */ be_nested_str_weak(animators), + /* K1 */ be_nested_str_weak(find), + /* K2 */ be_nested_str_weak(push), + }), + be_str_weak(add_animator), + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x80040400, // 0001 RET 1 R2 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100200, // 0002 MOVE R4 R1 + 0x7C080400, // 0003 CALL R2 2 + 0x4C0C0000, // 0004 LDNIL R3 + 0x1C080403, // 0005 EQ R2 R2 R3 + 0x780A0003, // 0006 JMPF R2 #000B + 0x88080100, // 0007 GETMBR R2 R0 K0 + 0x8C080502, // 0008 GETMET R2 R2 K2 + 0x5C100200, // 0009 MOVE R4 R1 + 0x7C080400, // 000A CALL R2 2 + 0x80000000, // 000B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: remove +********************************************************************/ +be_local_closure(Animate_core_remove, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str_weak(clear), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(remove_fast_loop), + /* K3 */ be_nested_str_weak(fast_loop_cb), + }), + be_str_weak(remove), + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x7C040200, // 0001 CALL R1 1 + 0xB8060200, // 0002 GETNGBL R1 K1 + 0x8C040302, // 0003 GETMET R1 R1 K2 + 0x880C0103, // 0004 GETMBR R3 R0 K3 + 0x7C040400, // 0005 CALL R1 2 + 0x80000000, // 0006 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: start +********************************************************************/ +be_local_closure(Animate_core_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 }) ) ); @@ -772,39 +823,40 @@ be_local_closure(Animate_core_get_bri, /* name */ be_local_class(Animate_core, 13, NULL, - be_nested_map(31, + be_nested_map(32, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_weak(get_bri, -1), be_const_closure(Animate_core_get_bri_closure) }, - { be_const_key_weak(remove, -1), be_const_closure(Animate_core_remove_closure) }, - { be_const_key_weak(painters, -1), be_const_var(5) }, - { be_const_key_weak(fast_loop_cb, -1), be_const_var(6) }, - { be_const_key_weak(start, 6), be_const_closure(Animate_core_start_closure) }, - { be_const_key_weak(add_background_animator, -1), be_const_closure(Animate_core_add_background_animator_closure) }, - { be_const_key_weak(set_back_color, 30), be_const_closure(Animate_core_set_back_color_closure) }, - { be_const_key_weak(add_animator, -1), be_const_closure(Animate_core_add_animator_closure) }, - { be_const_key_weak(strip, 3), be_const_var(0) }, - { be_const_key_weak(animate, 14), be_const_closure(Animate_core_animate_closure) }, - { be_const_key_weak(clear, 0), be_const_closure(Animate_core_clear_closure) }, - { be_const_key_weak(stop, -1), be_const_closure(Animate_core_stop_closure) }, - { be_const_key_weak(remove_painter, 28), be_const_closure(Animate_core_remove_painter_closure) }, - { be_const_key_weak(fast_loop_next, 21), be_const_var(7) }, + { be_const_key_weak(set_strip_bri, -1), be_const_closure(Animate_core_set_strip_bri_closure) }, { be_const_key_weak(animators, -1), be_const_var(4) }, - { be_const_key_weak(add_painter, -1), be_const_closure(Animate_core_add_painter_closure) }, - { be_const_key_weak(set_bri, -1), be_const_closure(Animate_core_set_bri_closure) }, - { be_const_key_weak(frame, -1), be_const_var(10) }, - { be_const_key_weak(mth, 26), be_const_var(9) }, - { be_const_key_weak(back_color, -1), be_const_var(12) }, - { be_const_key_weak(set_current, -1), be_const_closure(Animate_core_set_current_closure) }, - { be_const_key_weak(bri, -1), be_const_var(2) }, - { be_const_key_weak(fast_loop, -1), be_const_closure(Animate_core_fast_loop_closure) }, - { be_const_key_weak(layer, -1), be_const_var(11) }, - { be_const_key_weak(set_cb, 23), be_const_closure(Animate_core_set_cb_closure) }, - { be_const_key_weak(remove_animator, 22), be_const_closure(Animate_core_remove_animator_closure) }, + { be_const_key_weak(clear, 0), be_const_closure(Animate_core_clear_closure) }, + { be_const_key_weak(remove, -1), be_const_closure(Animate_core_remove_closure) }, + { be_const_key_weak(mth, -1), be_const_var(9) }, + { be_const_key_weak(stop, 1), be_const_closure(Animate_core_stop_closure) }, + { be_const_key_weak(fast_loop_cb, 30), be_const_var(6) }, + { be_const_key_weak(get_bri, -1), be_const_closure(Animate_core_get_bri_closure) }, + { be_const_key_weak(add_animator, -1), be_const_closure(Animate_core_add_animator_closure) }, + { be_const_key_weak(add_background_animator, -1), be_const_closure(Animate_core_add_background_animator_closure) }, + { be_const_key_weak(fast_loop_next, -1), be_const_var(7) }, + { be_const_key_weak(remove_animator, -1), be_const_closure(Animate_core_remove_animator_closure) }, + { be_const_key_weak(add_painter, 28), be_const_closure(Animate_core_add_painter_closure) }, { be_const_key_weak(FAST_LOOP_MIN, -1), be_const_int(20) }, - { be_const_key_weak(pixel_count, -1), be_const_var(1) }, - { be_const_key_weak(obj, -1), be_const_var(8) }, + { be_const_key_weak(fast_loop, -1), be_const_closure(Animate_core_fast_loop_closure) }, + { be_const_key_weak(set_back_color, 11), be_const_closure(Animate_core_set_back_color_closure) }, + { be_const_key_weak(animate, 8), be_const_closure(Animate_core_animate_closure) }, + { be_const_key_weak(strip, 24), be_const_var(0) }, + { be_const_key_weak(layer, -1), be_const_var(11) }, { be_const_key_weak(init, -1), be_const_closure(Animate_core_init_closure) }, + { be_const_key_weak(bri, -1), be_const_var(2) }, + { be_const_key_weak(set_cb, 13), be_const_closure(Animate_core_set_cb_closure) }, + { be_const_key_weak(back_color, 18), be_const_var(12) }, + { be_const_key_weak(pixel_count, 15), be_const_var(1) }, + { be_const_key_weak(set_current, -1), be_const_closure(Animate_core_set_current_closure) }, + { be_const_key_weak(painters, -1), be_const_var(5) }, + { be_const_key_weak(obj, 10), be_const_var(8) }, + { be_const_key_weak(set_bri, 9), be_const_closure(Animate_core_set_bri_closure) }, { be_const_key_weak(running, -1), be_const_var(3) }, + { be_const_key_weak(remove_painter, 3), be_const_closure(Animate_core_remove_painter_closure) }, + { be_const_key_weak(frame, -1), be_const_var(10) }, + { be_const_key_weak(start, -1), be_const_closure(Animate_core_start_closure) }, })), be_str_weak(Animate_core) ); diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_1_animate_effects.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_2_animate_effects.h similarity index 99% rename from lib/libesp32/berry_tasmota/src/solidify/solidified_animate_1_animate_effects.h rename to lib/libesp32/berry_tasmota/src/solidify/solidified_animate_2_animate_effects.h index 21bcdeb19..360e3d2d8 100644 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_1_animate_effects.h +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_2_animate_effects.h @@ -1,4 +1,4 @@ -/* Solidification of animate_1_animate_effects.h */ +/* Solidification of animate_2_animate_effects.h */ /********************************************************************\ * Generated code, don't edit * \********************************************************************/ diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_9_module.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_9_module.h index 7f12ffcca..e64059188 100644 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_9_module.h +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_9_module.h @@ -1384,32 +1384,31 @@ be_local_closure(Animate_oscillator_animate, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[21]) { /* constants */ + ( &(const bvalue[20]) { /* 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(originally), - /* K6 */ be_nested_str_weak(scale_uint), - /* K7 */ be_nested_str_weak(duty_cycle), - /* K8 */ be_nested_str_weak(beat), - /* K9 */ be_nested_str_weak(a), - /* K10 */ be_nested_str_weak(b), - /* K11 */ be_nested_str_weak(value), - /* K12 */ be_nested_str_weak(phase), - /* K13 */ be_nested_str_weak(form), - /* K14 */ be_const_int(1), - /* K15 */ be_nested_str_weak(scale_int), - /* K16 */ be_const_int(2), - /* K17 */ be_const_int(3), - /* K18 */ be_nested_str_weak(sine_int), - /* K19 */ be_nested_str_weak(obj), - /* K20 */ be_nested_str_weak(mth), + /* K5 */ be_nested_str_weak(scale_uint), + /* K6 */ be_nested_str_weak(duty_cycle), + /* K7 */ be_nested_str_weak(beat), + /* K8 */ be_nested_str_weak(a), + /* K9 */ be_nested_str_weak(b), + /* K10 */ be_nested_str_weak(value), + /* K11 */ be_nested_str_weak(phase), + /* K12 */ be_nested_str_weak(form), + /* K13 */ be_const_int(1), + /* K14 */ be_nested_str_weak(scale_int), + /* K15 */ be_const_int(2), + /* K16 */ be_const_int(3), + /* K17 */ be_nested_str_weak(sine_int), + /* K18 */ be_nested_str_weak(obj), + /* K19 */ be_nested_str_weak(mth), }), be_str_weak(animate), &be_const_str_solidified, - ( &(const binstruction[150]) { /* code */ + ( &(const binstruction[141]) { /* code */ 0x88080100, // 0000 GETMBR R2 R0 K0 0x4C0C0000, // 0001 LDNIL R3 0x1C080403, // 0002 EQ R2 R2 R3 @@ -1427,12 +1426,12 @@ be_local_closure(Animate_oscillator_animate, /* name */ 0x140C0504, // 000E LT R3 R2 K4 0x780E0001, // 000F JMPF R3 #0012 0x58080004, // 0010 LDCONST R2 K4 - 0x88040105, // 0011 GETMBR R1 R0 K5 + 0x88040103, // 0011 GETMBR R1 R0 K3 0x880C0100, // 0012 GETMBR R3 R0 K0 0x4C100000, // 0013 LDNIL R4 0xB8160200, // 0014 GETNGBL R5 K1 - 0x8C140B06, // 0015 GETMET R5 R5 K6 - 0x881C0107, // 0016 GETMBR R7 R0 K7 + 0x8C140B05, // 0015 GETMET R5 R5 K5 + 0x881C0106, // 0016 GETMBR R7 R0 K6 0x58200004, // 0017 LDCONST R8 K4 0x54260063, // 0018 LDINT R9 100 0x58280004, // 0019 LDCONST R10 K4 @@ -1447,18 +1446,18 @@ be_local_closure(Animate_oscillator_animate, /* name */ 0x00140A06, // 0022 ADD R5 R5 R6 0x90020605, // 0023 SETMBR R0 K3 R5 0x10080403, // 0024 MOD R2 R2 R3 - 0x8C140108, // 0025 GETMET R5 R0 K8 + 0x8C140107, // 0025 GETMET R5 R0 K7 0x7C140200, // 0026 CALL R5 1 - 0x88140109, // 0027 GETMBR R5 R0 K9 - 0x8818010A, // 0028 GETMBR R6 R0 K10 - 0x881C010B, // 0029 GETMBR R7 R0 K11 + 0x88140108, // 0027 GETMBR R5 R0 K8 + 0x88180109, // 0028 GETMBR R6 R0 K9 + 0x881C010A, // 0029 GETMBR R7 R0 K10 0x5C200400, // 002A MOVE R8 R2 - 0x8824010C, // 002B GETMBR R9 R0 K12 + 0x8824010B, // 002B GETMBR R9 R0 K11 0x24241304, // 002C GT R9 R9 K4 0x7826000B, // 002D JMPF R9 #003A 0xB8260200, // 002E GETNGBL R9 K1 - 0x8C241306, // 002F GETMET R9 R9 K6 - 0x882C010C, // 0030 GETMBR R11 R0 K12 + 0x8C241305, // 002F GETMET R9 R9 K5 + 0x882C010B, // 0030 GETMBR R11 R0 K11 0x58300004, // 0031 LDCONST R12 K4 0x54360063, // 0032 LDINT R13 100 0x58380004, // 0033 LDCONST R14 K4 @@ -1468,98 +1467,89 @@ be_local_closure(Animate_oscillator_animate, /* name */ 0x24241003, // 0037 GT R9 R8 R3 0x78260000, // 0038 JMPF R9 #003A 0x04201003, // 0039 SUB R8 R8 R3 - 0x8824010D, // 003A GETMBR R9 R0 K13 - 0x1C24130E, // 003B EQ R9 R9 K14 + 0x8824010C, // 003A GETMBR R9 R0 K12 + 0x1C24130D, // 003B EQ R9 R9 K13 0x78260009, // 003C JMPF R9 #0047 0xB8260200, // 003D GETNGBL R9 K1 - 0x8C24130F, // 003E GETMET R9 R9 K15 + 0x8C24130E, // 003E GETMET R9 R9 K14 0x5C2C1000, // 003F MOVE R11 R8 0x58300004, // 0040 LDCONST R12 K4 - 0x0434070E, // 0041 SUB R13 R3 K14 + 0x0434070D, // 0041 SUB R13 R3 K13 0x5C380A00, // 0042 MOVE R14 R5 0x5C3C0C00, // 0043 MOVE R15 R6 0x7C240C00, // 0044 CALL R9 6 0x5C1C1200, // 0045 MOVE R7 R9 - 0x70020044, // 0046 JMP #008C - 0x8824010D, // 0047 GETMBR R9 R0 K13 - 0x1C241310, // 0048 EQ R9 R9 K16 + 0x7002003B, // 0046 JMP #0083 + 0x8824010C, // 0047 GETMBR R9 R0 K12 + 0x1C24130F, // 0048 EQ R9 R9 K15 0x78260015, // 0049 JMPF R9 #0060 0x14241004, // 004A LT R9 R8 R4 0x78260009, // 004B JMPF R9 #0056 0xB8260200, // 004C GETNGBL R9 K1 - 0x8C24130F, // 004D GETMET R9 R9 K15 + 0x8C24130E, // 004D GETMET R9 R9 K14 0x5C2C1000, // 004E MOVE R11 R8 0x58300004, // 004F LDCONST R12 K4 - 0x0434090E, // 0050 SUB R13 R4 K14 + 0x0434090D, // 0050 SUB R13 R4 K13 0x5C380A00, // 0051 MOVE R14 R5 0x5C3C0C00, // 0052 MOVE R15 R6 0x7C240C00, // 0053 CALL R9 6 0x5C1C1200, // 0054 MOVE R7 R9 0x70020008, // 0055 JMP #005F 0xB8260200, // 0056 GETNGBL R9 K1 - 0x8C24130F, // 0057 GETMET R9 R9 K15 + 0x8C24130E, // 0057 GETMET R9 R9 K14 0x5C2C1000, // 0058 MOVE R11 R8 0x5C300800, // 0059 MOVE R12 R4 - 0x0434070E, // 005A SUB R13 R3 K14 + 0x0434070D, // 005A SUB R13 R3 K13 0x5C380C00, // 005B MOVE R14 R6 0x5C3C0A00, // 005C MOVE R15 R5 0x7C240C00, // 005D CALL R9 6 0x5C1C1200, // 005E MOVE R7 R9 - 0x7002002B, // 005F JMP #008C - 0x8824010D, // 0060 GETMBR R9 R0 K13 - 0x1C241311, // 0061 EQ R9 R9 K17 + 0x70020022, // 005F JMP #0083 + 0x8824010C, // 0060 GETMBR R9 R0 K12 + 0x1C241310, // 0061 EQ R9 R9 K16 0x78260005, // 0062 JMPF R9 #0069 0x14241004, // 0063 LT R9 R8 R4 0x78260001, // 0064 JMPF R9 #0067 0x5C1C0A00, // 0065 MOVE R7 R5 0x70020000, // 0066 JMP #0068 0x5C1C0C00, // 0067 MOVE R7 R6 - 0x70020022, // 0068 JMP #008C - 0x8824010D, // 0069 GETMBR R9 R0 K13 + 0x70020019, // 0068 JMP #0083 + 0x8824010C, // 0069 GETMBR R9 R0 K12 0x542A0003, // 006A LDINT R10 4 0x1C24120A, // 006B EQ R9 R9 R10 - 0x74260003, // 006C JMPT R9 #0071 - 0x8824010D, // 006D GETMBR R9 R0 K13 - 0x542A0004, // 006E LDINT R10 5 - 0x1C24120A, // 006F EQ R9 R9 R10 - 0x7826001A, // 0070 JMPF R9 #008C - 0xB8260200, // 0071 GETNGBL R9 K1 - 0x8C24130F, // 0072 GETMET R9 R9 K15 - 0x5C2C1000, // 0073 MOVE R11 R8 - 0x58300004, // 0074 LDCONST R12 K4 - 0x0434070E, // 0075 SUB R13 R3 K14 - 0x58380004, // 0076 LDCONST R14 K4 - 0x543E7FFE, // 0077 LDINT R15 32767 - 0x7C240C00, // 0078 CALL R9 6 - 0x8828010D, // 0079 GETMBR R10 R0 K13 - 0x542E0003, // 007A LDINT R11 4 - 0x1C28140B, // 007B EQ R10 R10 R11 - 0x782A0001, // 007C JMPF R10 #007F - 0x542A1FFF, // 007D LDINT R10 8192 - 0x0424120A, // 007E SUB R9 R9 R10 - 0xB82A0200, // 007F GETNGBL R10 K1 - 0x8C281512, // 0080 GETMET R10 R10 K18 - 0x5C301200, // 0081 MOVE R12 R9 - 0x7C280400, // 0082 CALL R10 2 - 0xB82E0200, // 0083 GETNGBL R11 K1 - 0x8C2C170F, // 0084 GETMET R11 R11 K15 - 0x5C341400, // 0085 MOVE R13 R10 - 0x5439EFFF, // 0086 LDINT R14 -4096 - 0x543E0FFF, // 0087 LDINT R15 4096 - 0x5C400A00, // 0088 MOVE R16 R5 - 0x5C440C00, // 0089 MOVE R17 R6 - 0x7C2C0C00, // 008A CALL R11 6 - 0x5C1C1600, // 008B MOVE R7 R11 - 0x90021607, // 008C SETMBR R0 K11 R7 - 0x88240113, // 008D GETMBR R9 R0 K19 - 0x88280114, // 008E GETMBR R10 R0 K20 - 0x78260004, // 008F JMPF R9 #0095 - 0x782A0003, // 0090 JMPF R10 #0095 - 0x5C2C1400, // 0091 MOVE R11 R10 - 0x5C301200, // 0092 MOVE R12 R9 - 0x5C340E00, // 0093 MOVE R13 R7 - 0x7C2C0400, // 0094 CALL R11 2 - 0x80040E00, // 0095 RET 1 R7 + 0x78260015, // 006C JMPF R9 #0083 + 0xB8260200, // 006D GETNGBL R9 K1 + 0x8C24130E, // 006E GETMET R9 R9 K14 + 0x5C2C1000, // 006F MOVE R11 R8 + 0x58300004, // 0070 LDCONST R12 K4 + 0x0434070D, // 0071 SUB R13 R3 K13 + 0x58380004, // 0072 LDCONST R14 K4 + 0x543E7FFE, // 0073 LDINT R15 32767 + 0x7C240C00, // 0074 CALL R9 6 + 0xB82A0200, // 0075 GETNGBL R10 K1 + 0x8C281511, // 0076 GETMET R10 R10 K17 + 0x54321FFF, // 0077 LDINT R12 8192 + 0x0430120C, // 0078 SUB R12 R9 R12 + 0x7C280400, // 0079 CALL R10 2 + 0xB82E0200, // 007A GETNGBL R11 K1 + 0x8C2C170E, // 007B GETMET R11 R11 K14 + 0x5C341400, // 007C MOVE R13 R10 + 0x5439EFFF, // 007D LDINT R14 -4096 + 0x543E0FFF, // 007E LDINT R15 4096 + 0x5C400A00, // 007F MOVE R16 R5 + 0x5C440C00, // 0080 MOVE R17 R6 + 0x7C2C0C00, // 0081 CALL R11 6 + 0x5C1C1600, // 0082 MOVE R7 R11 + 0x90021407, // 0083 SETMBR R0 K10 R7 + 0x88240112, // 0084 GETMBR R9 R0 K18 + 0x88280113, // 0085 GETMBR R10 R0 K19 + 0x78260004, // 0086 JMPF R9 #008C + 0x782A0003, // 0087 JMPF R10 #008C + 0x5C2C1400, // 0088 MOVE R11 R10 + 0x5C301200, // 0089 MOVE R12 R9 + 0x5C340E00, // 008A MOVE R13 R7 + 0x7C2C0400, // 008B CALL R11 2 + 0x80040E00, // 008C RET 1 R7 }) ) ); diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds.h index ef3af9aba..3e0ef7846 100644 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds.h +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds.h @@ -6,36 +6,6 @@ extern const bclass be_class_Leds; -/******************************************************************** -** Solidified function: show -********************************************************************/ -be_local_closure(Leds_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(2), - }), - &be_const_str_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 - 0x80000000, // 0003 RET 0 - }) - ) -); -/*******************************************************************/ - - extern const bclass be_class_Leds_segment; /******************************************************************** @@ -78,28 +48,33 @@ be_local_closure(Leds_segment_clear_to, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(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), + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(bri), + /* K1 */ be_nested_str(strip), + /* K2 */ be_nested_str(call_native), + /* K3 */ be_nested_str(to_gamma), + /* K4 */ be_nested_str(offset), + /* K5 */ be_nested_str(leds), }), &be_const_str_clear_to, &be_const_str_solidified, - ( &(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 + ( &(const binstruction[16]) { /* code */ + 0x4C0C0000, // 0000 LDNIL R3 + 0x1C0C0403, // 0001 EQ R3 R2 R3 + 0x780E0000, // 0002 JMPF R3 #0004 + 0x88080100, // 0003 GETMBR R2 R0 K0 + 0x880C0101, // 0004 GETMBR R3 R0 K1 + 0x8C0C0702, // 0005 GETMET R3 R3 K2 + 0x54160008, // 0006 LDINT R5 9 + 0x88180101, // 0007 GETMBR R6 R0 K1 + 0x8C180D03, // 0008 GETMET R6 R6 K3 + 0x5C200200, // 0009 MOVE R8 R1 + 0x5C240400, // 000A MOVE R9 R2 + 0x7C180600, // 000B CALL R6 3 + 0x881C0104, // 000C GETMBR R7 R0 K4 + 0x88200105, // 000D GETMBR R8 R0 K5 + 0x7C0C0A00, // 000E CALL R3 5 + 0x80000000, // 000F RET 0 }) ) ); @@ -231,22 +206,27 @@ be_local_closure(Leds_segment_set_pixel_color, /* name */ 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), + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str(bri), + /* K1 */ be_nested_str(strip), + /* K2 */ be_nested_str(set_pixel_color), + /* K3 */ 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 + ( &(const binstruction[12]) { /* code */ + 0x4C100000, // 0000 LDNIL R4 + 0x1C100604, // 0001 EQ R4 R3 R4 + 0x78120000, // 0002 JMPF R4 #0004 + 0x880C0100, // 0003 GETMBR R3 R0 K0 + 0x88100101, // 0004 GETMBR R4 R0 K1 + 0x8C100902, // 0005 GETMET R4 R4 K2 + 0x88180103, // 0006 GETMBR R6 R0 K3 + 0x00180206, // 0007 ADD R6 R1 R6 + 0x5C1C0400, // 0008 MOVE R7 R2 + 0x5C200600, // 0009 MOVE R8 R3 + 0x7C100800, // 000A CALL R4 4 + 0x80000000, // 000B RET 0 }) ) ); @@ -567,112 +547,34 @@ be_local_closure(Leds_create_segment, /* name */ /******************************************************************** -** Solidified function: assign_rmt +** Solidified function: set_bri ********************************************************************/ -be_local_closure(Leds_assign_rmt, /* name */ +be_local_closure(Leds_set_bri, /* name */ be_nested_proto( - 9, /* nstack */ - 1, /* argc */ - 4, /* varg */ + 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[17]) { /* constants */ - /* K0 */ be_const_class(be_class_Leds), - /* K1 */ be_const_int(0), - /* K2 */ be_nested_str(value_error), - /* K3 */ be_nested_str(invalid_X20GPIO_X20number), - /* K4 */ be_nested_str(global), - /* K5 */ be_nested_str(contains), - /* K6 */ be_nested_str(_rmt), - /* K7 */ be_nested_str(gpio), - /* K8 */ be_nested_str(MAX_RMT), - /* K9 */ be_const_int(1), - /* K10 */ be_nested_str(push), - /* K11 */ be_nested_str(stop_iteration), - /* K12 */ be_nested_str(pin_used), - /* K13 */ be_nested_str(WS2812), - /* K14 */ be_nested_str(pin), - /* K15 */ be_nested_str(internal_error), - /* K16 */ be_nested_str(no_X20more_X20RMT_X20channel_X20available), + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_nested_str(bri), }), - &be_const_str_assign_rmt, + &be_const_str_set_bri, &be_const_str_solidified, - ( &(const binstruction[72]) { /* code */ - 0x58040000, // 0000 LDCONST R1 K0 - 0x60080009, // 0001 GETGBL R2 G9 - 0x5C0C0000, // 0002 MOVE R3 R0 - 0x7C080200, // 0003 CALL R2 1 - 0x5C000400, // 0004 MOVE R0 R2 - 0x14080101, // 0005 LT R2 R0 K1 - 0x780A0000, // 0006 JMPF R2 #0008 - 0xB0060503, // 0007 RAISE 1 K2 K3 - 0xA40A0800, // 0008 IMPORT R2 K4 - 0x4C0C0000, // 0009 LDNIL R3 - 0x8C100505, // 000A GETMET R4 R2 K5 - 0x58180006, // 000B LDCONST R6 K6 - 0x7C100400, // 000C CALL R4 2 - 0x74120021, // 000D JMPT R4 #0030 - 0x60100012, // 000E GETGBL R4 G18 - 0x7C100000, // 000F CALL R4 0 - 0x5C0C0800, // 0010 MOVE R3 R4 - 0x900A0C03, // 0011 SETMBR R2 K6 R3 - 0x60100010, // 0012 GETGBL R4 G16 - 0xB8160E00, // 0013 GETNGBL R5 K7 - 0x88140B08, // 0014 GETMBR R5 R5 K8 - 0x04140B09, // 0015 SUB R5 R5 K9 - 0x40160205, // 0016 CONNECT R5 K1 R5 - 0x7C100200, // 0017 CALL R4 1 - 0xA8020005, // 0018 EXBLK 0 #001F - 0x5C140800, // 0019 MOVE R5 R4 - 0x7C140000, // 001A CALL R5 0 - 0x8C18070A, // 001B GETMET R6 R3 K10 - 0x5421FFFE, // 001C LDINT R8 -1 - 0x7C180400, // 001D CALL R6 2 - 0x7001FFF9, // 001E JMP #0019 - 0x5810000B, // 001F LDCONST R4 K11 - 0xAC100200, // 0020 CATCH R4 1 0 - 0xB0080000, // 0021 RAISE 2 R0 R0 - 0xB8120E00, // 0022 GETNGBL R4 K7 - 0x8C10090C, // 0023 GETMET R4 R4 K12 - 0xB81A0E00, // 0024 GETNGBL R6 K7 - 0x88180D0D, // 0025 GETMBR R6 R6 K13 - 0x581C0001, // 0026 LDCONST R7 K1 - 0x7C100600, // 0027 CALL R4 3 - 0x78120006, // 0028 JMPF R4 #0030 - 0xB8120E00, // 0029 GETNGBL R4 K7 - 0x8C10090E, // 002A GETMET R4 R4 K14 - 0xB81A0E00, // 002B GETNGBL R6 K7 - 0x88180D0D, // 002C GETMBR R6 R6 K13 - 0x581C0001, // 002D LDCONST R7 K1 - 0x7C100600, // 002E CALL R4 3 - 0x980E0204, // 002F SETIDX R3 K1 R4 - 0x880C0506, // 0030 GETMBR R3 R2 K6 - 0x58100001, // 0031 LDCONST R4 K1 - 0x5415FFFE, // 0032 LDINT R5 -1 - 0xB81A0E00, // 0033 GETNGBL R6 K7 - 0x88180D08, // 0034 GETMBR R6 R6 K8 - 0x14180806, // 0035 LT R6 R4 R6 - 0x781A000A, // 0036 JMPF R6 #0042 - 0x94180604, // 0037 GETIDX R6 R3 R4 - 0x1C1C0C00, // 0038 EQ R7 R6 R0 - 0x781E0000, // 0039 JMPF R7 #003B - 0x80040800, // 003A RET 1 R4 - 0x141C0D01, // 003B LT R7 R6 K1 - 0x781E0002, // 003C JMPF R7 #0040 - 0x141C0B01, // 003D LT R7 R5 K1 - 0x781E0000, // 003E JMPF R7 #0040 - 0x5C140800, // 003F MOVE R5 R4 - 0x00100909, // 0040 ADD R4 R4 K9 - 0x7001FFF0, // 0041 JMP #0033 - 0x28180B01, // 0042 GE R6 R5 K1 - 0x781A0001, // 0043 JMPF R6 #0046 - 0x980C0A00, // 0044 SETIDX R3 R5 R0 - 0x80040A00, // 0045 RET 1 R5 - 0xB0061F10, // 0046 RAISE 1 K15 K16 - 0x80000000, // 0047 RET 0 + ( &(const binstruction[ 9]) { /* code */ + 0x14080300, // 0000 LT R2 R1 K0 + 0x780A0000, // 0001 JMPF R2 #0003 + 0x58040000, // 0002 LDCONST R1 K0 + 0x540A00FE, // 0003 LDINT R2 255 + 0x24080202, // 0004 GT R2 R1 R2 + 0x780A0000, // 0005 JMPF R2 #0007 + 0x540600FE, // 0006 LDINT R1 255 + 0x90020201, // 0007 SETMBR R0 K1 R1 + 0x80000000, // 0008 RET 0 }) ) ); @@ -680,9 +582,9 @@ be_local_closure(Leds_assign_rmt, /* name */ /******************************************************************** -** Solidified function: can_show +** Solidified function: begin ********************************************************************/ -be_local_closure(Leds_can_show, /* name */ +be_local_closure(Leds_begin, /* name */ be_nested_proto( 4, /* nstack */ 1, /* argc */ @@ -694,14 +596,203 @@ 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: 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: 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[10]) { /* constants */ + /* K0 */ be_nested_str(gamma), + /* K1 */ be_nested_str(leds), + /* K2 */ be_nested_str(bri), + /* K3 */ be_nested_str(valuer_error), + /* K4 */ be_nested_str(no_X20GPIO_X20specified_X20for_X20neopixelbus), + /* K5 */ be_nested_str(ctor), + /* K6 */ be_nested_str(_p), + /* K7 */ be_nested_str(internal_error), + /* K8 */ be_nested_str(couldn_X27t_X20not_X20initialize_X20noepixelbus), + /* K9 */ be_nested_str(begin), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[26]) { /* 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 + 0x5416007E, // 0006 LDINT R5 127 + 0x90020405, // 0007 SETMBR R0 K2 R5 + 0x4C140000, // 0008 LDNIL R5 + 0x1C140405, // 0009 EQ R5 R2 R5 + 0x78160000, // 000A JMPF R5 #000C + 0xB0060704, // 000B RAISE 1 K3 K4 + 0x8C140105, // 000C GETMET R5 R0 K5 + 0x881C0101, // 000D GETMBR R7 R0 K1 + 0x5C200400, // 000E MOVE R8 R2 + 0x5C240600, // 000F MOVE R9 R3 + 0x5C280800, // 0010 MOVE R10 R4 + 0x7C140A00, // 0011 CALL R5 5 + 0x88140106, // 0012 GETMBR R5 R0 K6 + 0x4C180000, // 0013 LDNIL R6 + 0x1C140A06, // 0014 EQ R5 R5 R6 + 0x78160000, // 0015 JMPF R5 #0017 + 0xB0060F08, // 0016 RAISE 1 K7 K8 + 0x8C140109, // 0017 GETMET R5 R0 K9 + 0x7C140200, // 0018 CALL R5 1 + 0x80000000, // 0019 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: to_gamma +********************************************************************/ +be_local_closure(Leds_to_gamma, /* name */ + be_nested_proto( + 8, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(bri), + /* K1 */ be_nested_str(apply_bri_gamma), + /* K2 */ be_nested_str(gamma), + }), + &be_const_str_to_gamma, + &be_const_str_solidified, + ( &(const binstruction[10]) { /* code */ + 0x4C0C0000, // 0000 LDNIL R3 + 0x1C0C0403, // 0001 EQ R3 R2 R3 + 0x780E0000, // 0002 JMPF R3 #0004 + 0x88080100, // 0003 GETMBR R2 R0 K0 + 0x8C0C0101, // 0004 GETMET R3 R0 K1 + 0x5C140200, // 0005 MOVE R5 R1 + 0x5C180400, // 0006 MOVE R6 R2 + 0x881C0102, // 0007 GETMBR R7 R0 K2 + 0x7C0C0800, // 0008 CALL R3 4 + 0x80040600, // 0009 RET 1 R3 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: show +********************************************************************/ +be_local_closure(Leds_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(2), + }), + &be_const_str_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 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** 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 }) ) @@ -709,6 +800,122 @@ be_local_closure(Leds_can_show, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: get_bri +********************************************************************/ +be_local_closure(Leds_get_bri, /* 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(bri), + }), + &be_const_str_get_bri, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_gamma +********************************************************************/ +be_local_closure(Leds_set_gamma, /* 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(gamma), + }), + &be_const_str_set_gamma, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x60080017, // 0000 GETGBL R2 G23 + 0x5C0C0200, // 0001 MOVE R3 R1 + 0x7C080200, // 0002 CALL R2 1 + 0x90020002, // 0003 SETMBR R0 K0 R2 + 0x80000000, // 0004 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: 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: matrix ********************************************************************/ @@ -750,11 +957,11 @@ be_local_closure(Leds_matrix, /* name */ /******************************************************************** -** Solidified function: pixel_count +** Solidified function: pixel_offset ********************************************************************/ -be_local_closure(Leds_pixel_count, /* name */ +be_local_closure(Leds_pixel_offset, /* name */ be_nested_proto( - 4, /* nstack */ + 1, /* nstack */ 1, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -763,15 +970,12 @@ be_local_closure(Leds_pixel_count, /* name */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(call_native), + /* K0 */ be_const_int(0), }), - &be_const_str_pixel_count, + &be_const_str_pixel_offset, &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 + ( &(const binstruction[ 1]) { /* code */ + 0x80060000, // 0000 RET 1 K0 }) ) ); @@ -779,77 +983,38 @@ be_local_closure(Leds_pixel_count, /* name */ /******************************************************************** -** Solidified function: is_dirty +** Solidified function: clear_to ********************************************************************/ -be_local_closure(Leds_is_dirty, /* name */ +be_local_closure(Leds_clear_to, /* name */ be_nested_proto( - 4, /* nstack */ - 1, /* argc */ + 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[ 1]) { /* constants */ - /* K0 */ be_nested_str(call_native), + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(bri), + /* K1 */ be_nested_str(call_native), + /* K2 */ be_nested_str(to_gamma), }), - &be_const_str_is_dirty, + &be_const_str_clear_to, &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 + ( &(const binstruction[12]) { /* code */ + 0x4C0C0000, // 0000 LDNIL R3 + 0x1C0C0403, // 0001 EQ R3 R2 R3 + 0x780E0000, // 0002 JMPF R3 #0004 + 0x88080100, // 0003 GETMBR R2 R0 K0 + 0x8C0C0101, // 0004 GETMET R3 R0 K1 + 0x54160008, // 0005 LDINT R5 9 + 0x8C180102, // 0006 GETMET R6 R0 K2 + 0x5C200200, // 0007 MOVE R8 R1 + 0x5C240400, // 0008 MOVE R9 R2 + 0x7C180600, // 0009 CALL R6 3 + 0x7C0C0600, // 000A CALL R3 3 + 0x80000000, // 000B RET 0 }) ) ); @@ -869,22 +1034,56 @@ be_local_closure(Leds_set_pixel_color, /* name */ 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), + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(bri), + /* K1 */ be_nested_str(call_native), + /* K2 */ 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 + ( &(const binstruction[13]) { /* code */ + 0x4C100000, // 0000 LDNIL R4 + 0x1C100604, // 0001 EQ R4 R3 R4 + 0x78120000, // 0002 JMPF R4 #0004 + 0x880C0100, // 0003 GETMBR R3 R0 K0 + 0x8C100101, // 0004 GETMET R4 R0 K1 + 0x541A0009, // 0005 LDINT R6 10 + 0x5C1C0200, // 0006 MOVE R7 R1 + 0x8C200102, // 0007 GETMET R8 R0 K2 + 0x5C280400, // 0008 MOVE R10 R2 + 0x5C2C0600, // 0009 MOVE R11 R3 + 0x7C200600, // 000A CALL R8 3 + 0x7C100800, // 000B CALL R4 4 + 0x80000000, // 000C 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 }) ) ); @@ -906,31 +1105,36 @@ be_local_closure(Leds_matrix_clear_to, /* name */ 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), + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_nested_str(bri), + /* K1 */ be_nested_str(strip), + /* K2 */ be_nested_str(call_native), + /* K3 */ be_nested_str(to_gamma), + /* K4 */ be_nested_str(offset), + /* K5 */ be_nested_str(w), + /* K6 */ 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 + ( &(const binstruction[18]) { /* code */ + 0x4C0C0000, // 0000 LDNIL R3 + 0x1C0C0403, // 0001 EQ R3 R2 R3 + 0x780E0000, // 0002 JMPF R3 #0004 + 0x88080100, // 0003 GETMBR R2 R0 K0 + 0x880C0101, // 0004 GETMBR R3 R0 K1 + 0x8C0C0702, // 0005 GETMET R3 R3 K2 + 0x54160008, // 0006 LDINT R5 9 + 0x88180101, // 0007 GETMBR R6 R0 K1 + 0x8C180D03, // 0008 GETMET R6 R6 K3 + 0x5C200200, // 0009 MOVE R8 R1 + 0x5C240400, // 000A MOVE R9 R2 + 0x7C180600, // 000B CALL R6 3 + 0x881C0104, // 000C GETMBR R7 R0 K4 + 0x88200105, // 000D GETMBR R8 R0 K5 + 0x88240106, // 000E GETMBR R9 R0 K6 + 0x08201009, // 000F MUL R8 R8 R9 + 0x7C0C0A00, // 0010 CALL R3 5 + 0x80000000, // 0011 RET 0 }) ) ); @@ -1081,22 +1285,27 @@ be_local_closure(Leds_matrix_set_pixel_color, /* name */ 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), + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str(bri), + /* K1 */ be_nested_str(strip), + /* K2 */ be_nested_str(set_pixel_color), + /* K3 */ 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 + ( &(const binstruction[12]) { /* code */ + 0x4C100000, // 0000 LDNIL R4 + 0x1C100604, // 0001 EQ R4 R3 R4 + 0x78120000, // 0002 JMPF R4 #0004 + 0x880C0100, // 0003 GETMBR R3 R0 K0 + 0x88100101, // 0004 GETMBR R4 R0 K1 + 0x8C100902, // 0005 GETMET R4 R4 K2 + 0x88180103, // 0006 GETMBR R6 R0 K3 + 0x00180206, // 0007 ADD R6 R1 R6 + 0x5C1C0400, // 0008 MOVE R7 R2 + 0x5C200600, // 0009 MOVE R8 R3 + 0x7C100800, // 000A CALL R4 4 + 0x80000000, // 000B RET 0 }) ) ); @@ -1176,48 +1385,53 @@ be_local_closure(Leds_matrix_set_matrix_pixel_color, /* name */ 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), + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str(bri), + /* K1 */ be_nested_str(alternate), + /* K2 */ be_const_int(2), + /* K3 */ be_nested_str(strip), + /* K4 */ be_nested_str(set_pixel_color), + /* K5 */ be_nested_str(w), + /* K6 */ be_nested_str(h), + /* K7 */ be_const_int(1), + /* K8 */ 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 + ( &(const binstruction[33]) { /* code */ + 0x4C140000, // 0000 LDNIL R5 + 0x1C140805, // 0001 EQ R5 R4 R5 + 0x78160000, // 0002 JMPF R5 #0004 + 0x88100100, // 0003 GETMBR R4 R0 K0 + 0x88140101, // 0004 GETMBR R5 R0 K1 + 0x7816000F, // 0005 JMPF R5 #0016 + 0x10140302, // 0006 MOD R5 R1 K2 + 0x7816000D, // 0007 JMPF R5 #0016 + 0x88140103, // 0008 GETMBR R5 R0 K3 + 0x8C140B04, // 0009 GETMET R5 R5 K4 + 0x881C0105, // 000A GETMBR R7 R0 K5 + 0x081C0207, // 000B MUL R7 R1 R7 + 0x88200106, // 000C GETMBR R8 R0 K6 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 + 0x041C0E02, // 000E SUB R7 R7 R2 + 0x041C0F07, // 000F SUB R7 R7 K7 + 0x88200108, // 0010 GETMBR R8 R0 K8 + 0x001C0E08, // 0011 ADD R7 R7 R8 + 0x5C200600, // 0012 MOVE R8 R3 + 0x5C240800, // 0013 MOVE R9 R4 + 0x7C140800, // 0014 CALL R5 4 + 0x70020009, // 0015 JMP #0020 + 0x88140103, // 0016 GETMBR R5 R0 K3 + 0x8C140B04, // 0017 GETMET R5 R5 K4 + 0x881C0105, // 0018 GETMBR R7 R0 K5 + 0x081C0207, // 0019 MUL R7 R1 R7 + 0x001C0E02, // 001A ADD R7 R7 R2 + 0x88200108, // 001B GETMBR R8 R0 K8 + 0x001C0E08, // 001C ADD R7 R7 R8 + 0x5C200600, // 001D MOVE R8 R3 + 0x5C240800, // 001E MOVE R9 R4 + 0x7C140800, // 001F CALL R5 4 + 0x80000000, // 0020 RET 0 }) ) ); @@ -1635,12 +1849,68 @@ be_local_closure(Leds_create_matrix, /* name */ /******************************************************************** -** Solidified function: to_gamma +** Solidified function: get_gamma ********************************************************************/ -be_local_closure(Leds_to_gamma, /* name */ +be_local_closure(Leds_get_gamma, /* name */ be_nested_proto( - 8, /* nstack */ - 3, /* argc */ + 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(gamma), + }), + &be_const_str_get_gamma, + &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_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: can_show +********************************************************************/ +be_local_closure(Leds_can_show, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ @@ -1648,18 +1918,129 @@ be_local_closure(Leds_to_gamma, /* name */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(apply_bri_gamma), - /* K1 */ be_nested_str(gamma), + /* K0 */ be_nested_str(call_native), + /* K1 */ be_const_int(3), }), - &be_const_str_to_gamma, + &be_const_str_can_show, &be_const_str_solidified, - ( &(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 + ( &(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: assign_rmt +********************************************************************/ +be_local_closure(Leds_assign_rmt, /* name */ + be_nested_proto( + 9, /* nstack */ + 1, /* argc */ + 4, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[17]) { /* constants */ + /* K0 */ be_const_class(be_class_Leds), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(value_error), + /* K3 */ be_nested_str(invalid_X20GPIO_X20number), + /* K4 */ be_nested_str(global), + /* K5 */ be_nested_str(contains), + /* K6 */ be_nested_str(_rmt), + /* K7 */ be_nested_str(gpio), + /* K8 */ be_nested_str(MAX_RMT), + /* K9 */ be_const_int(1), + /* K10 */ be_nested_str(push), + /* K11 */ be_nested_str(stop_iteration), + /* K12 */ be_nested_str(pin_used), + /* K13 */ be_nested_str(WS2812), + /* K14 */ be_nested_str(pin), + /* K15 */ be_nested_str(internal_error), + /* K16 */ be_nested_str(no_X20more_X20RMT_X20channel_X20available), + }), + &be_const_str_assign_rmt, + &be_const_str_solidified, + ( &(const binstruction[72]) { /* code */ + 0x58040000, // 0000 LDCONST R1 K0 + 0x60080009, // 0001 GETGBL R2 G9 + 0x5C0C0000, // 0002 MOVE R3 R0 + 0x7C080200, // 0003 CALL R2 1 + 0x5C000400, // 0004 MOVE R0 R2 + 0x14080101, // 0005 LT R2 R0 K1 + 0x780A0000, // 0006 JMPF R2 #0008 + 0xB0060503, // 0007 RAISE 1 K2 K3 + 0xA40A0800, // 0008 IMPORT R2 K4 + 0x4C0C0000, // 0009 LDNIL R3 + 0x8C100505, // 000A GETMET R4 R2 K5 + 0x58180006, // 000B LDCONST R6 K6 + 0x7C100400, // 000C CALL R4 2 + 0x74120021, // 000D JMPT R4 #0030 + 0x60100012, // 000E GETGBL R4 G18 + 0x7C100000, // 000F CALL R4 0 + 0x5C0C0800, // 0010 MOVE R3 R4 + 0x900A0C03, // 0011 SETMBR R2 K6 R3 + 0x60100010, // 0012 GETGBL R4 G16 + 0xB8160E00, // 0013 GETNGBL R5 K7 + 0x88140B08, // 0014 GETMBR R5 R5 K8 + 0x04140B09, // 0015 SUB R5 R5 K9 + 0x40160205, // 0016 CONNECT R5 K1 R5 + 0x7C100200, // 0017 CALL R4 1 + 0xA8020005, // 0018 EXBLK 0 #001F + 0x5C140800, // 0019 MOVE R5 R4 + 0x7C140000, // 001A CALL R5 0 + 0x8C18070A, // 001B GETMET R6 R3 K10 + 0x5421FFFE, // 001C LDINT R8 -1 + 0x7C180400, // 001D CALL R6 2 + 0x7001FFF9, // 001E JMP #0019 + 0x5810000B, // 001F LDCONST R4 K11 + 0xAC100200, // 0020 CATCH R4 1 0 + 0xB0080000, // 0021 RAISE 2 R0 R0 + 0xB8120E00, // 0022 GETNGBL R4 K7 + 0x8C10090C, // 0023 GETMET R4 R4 K12 + 0xB81A0E00, // 0024 GETNGBL R6 K7 + 0x88180D0D, // 0025 GETMBR R6 R6 K13 + 0x581C0001, // 0026 LDCONST R7 K1 + 0x7C100600, // 0027 CALL R4 3 + 0x78120006, // 0028 JMPF R4 #0030 + 0xB8120E00, // 0029 GETNGBL R4 K7 + 0x8C10090E, // 002A GETMET R4 R4 K14 + 0xB81A0E00, // 002B GETNGBL R6 K7 + 0x88180D0D, // 002C GETMBR R6 R6 K13 + 0x581C0001, // 002D LDCONST R7 K1 + 0x7C100600, // 002E CALL R4 3 + 0x980E0204, // 002F SETIDX R3 K1 R4 + 0x880C0506, // 0030 GETMBR R3 R2 K6 + 0x58100001, // 0031 LDCONST R4 K1 + 0x5415FFFE, // 0032 LDINT R5 -1 + 0xB81A0E00, // 0033 GETNGBL R6 K7 + 0x88180D08, // 0034 GETMBR R6 R6 K8 + 0x14180806, // 0035 LT R6 R4 R6 + 0x781A000A, // 0036 JMPF R6 #0042 + 0x94180604, // 0037 GETIDX R6 R3 R4 + 0x1C1C0C00, // 0038 EQ R7 R6 R0 + 0x781E0000, // 0039 JMPF R7 #003B + 0x80040800, // 003A RET 1 R4 + 0x141C0D01, // 003B LT R7 R6 K1 + 0x781E0002, // 003C JMPF R7 #0040 + 0x141C0B01, // 003D LT R7 R5 K1 + 0x781E0000, // 003E JMPF R7 #0040 + 0x5C140800, // 003F MOVE R5 R4 + 0x00100909, // 0040 ADD R4 R4 K9 + 0x7001FFF0, // 0041 JMP #0033 + 0x28180B01, // 0042 GE R6 R5 K1 + 0x781A0001, // 0043 JMPF R6 #0046 + 0x980C0A00, // 0044 SETIDX R3 R5 R0 + 0x80040A00, // 0045 RET 1 R5 + 0xB0061F10, // 0046 RAISE 1 K15 K16 + 0x80000000, // 0047 RET 0 }) ) ); @@ -1714,74 +2095,11 @@ be_local_closure(Leds_ctor, /* name */ /******************************************************************** -** Solidified function: dirty +** Solidified function: pixels_buffer ********************************************************************/ -be_local_closure(Leds_dirty, /* name */ +be_local_closure(Leds_pixels_buffer, /* 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 */ + 8, /* nstack */ 2, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -1789,192 +2107,36 @@ be_local_closure(Leds_get_pixel_color, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 1]) { /* 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_get_pixel_color, + &be_const_str_pixels_buffer, &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ + ( &(const binstruction[21]) { /* 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 */ - 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 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** 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 + 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 }) ) ); @@ -1986,32 +2148,37 @@ be_local_closure(Leds_pixel_size, /* name */ ********************************************************************/ extern const bclass be_class_Leds_ntv; be_local_class(Leds, - 2, + 3, &be_class_Leds_ntv, - be_nested_map(22, + be_nested_map(27, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(show, -1), be_const_closure(Leds_show_closure) }, - { be_const_key(create_segment, -1), be_const_closure(Leds_create_segment_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(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(create_segment, 25), be_const_closure(Leds_create_segment_closure) }, { be_const_key(clear, -1), be_const_closure(Leds_clear_closure) }, - { be_const_key(pixel_offset, 3), be_const_closure(Leds_pixel_offset_closure) }, + { be_const_key(begin, -1), be_const_closure(Leds_begin_closure) }, + { be_const_key(ctor, 7), be_const_closure(Leds_ctor_closure) }, + { be_const_key(assign_rmt, 12), be_const_static_closure(Leds_assign_rmt_closure) }, + { be_const_key(to_gamma, 8), be_const_closure(Leds_to_gamma_closure) }, + { be_const_key(dirty, -1), be_const_closure(Leds_dirty_closure) }, + { be_const_key(matrix, -1), be_const_static_closure(Leds_matrix_closure) }, + { be_const_key(pixel_offset, 2), be_const_closure(Leds_pixel_offset_closure) }, + { be_const_key(set_gamma, 4), be_const_closure(Leds_set_gamma_closure) }, + { be_const_key(get_pixel_color, -1), be_const_closure(Leds_get_pixel_color_closure) }, + { be_const_key(pixel_size, -1), be_const_closure(Leds_pixel_size_closure) }, + { be_const_key(create_matrix, -1), be_const_closure(Leds_create_matrix_closure) }, + { be_const_key(set_bri, 9), be_const_closure(Leds_set_bri_closure) }, + { be_const_key(clear_to, -1), be_const_closure(Leds_clear_to_closure) }, + { be_const_key(set_pixel_color, -1), be_const_closure(Leds_set_pixel_color_closure) }, + { be_const_key(gamma, -1), be_const_var(0) }, + { be_const_key(pixel_count, 17), be_const_closure(Leds_pixel_count_closure) }, + { be_const_key(get_bri, 13), be_const_closure(Leds_get_bri_closure) }, + { be_const_key(get_gamma, -1), be_const_closure(Leds_get_gamma_closure) }, + { be_const_key(bri, -1), be_const_var(2) }, + { be_const_key(is_dirty, -1), be_const_closure(Leds_is_dirty_closure) }, + { be_const_key(can_show, -1), be_const_closure(Leds_can_show_closure) }, + { be_const_key(init, 5), be_const_closure(Leds_init_closure) }, + { be_const_key(show, -1), be_const_closure(Leds_show_closure) }, + { be_const_key(pixels_buffer, -1), be_const_closure(Leds_pixels_buffer_closure) }, })), (bstring*) &be_const_str_Leds ); diff --git a/tasmota/berry/animate_demo/animate_demo_pulse.be b/tasmota/berry/animate_demo/animate_demo_pulse.be index 82c2d5ee3..0b60b0993 100644 --- a/tasmota/berry/animate_demo/animate_demo_pulse.be +++ b/tasmota/berry/animate_demo/animate_demo_pulse.be @@ -8,12 +8,13 @@ var duration = 10000 var strip = Leds(5 * 5, gpio.pin(gpio.WS2812, 0)) var anim = animate.core(strip) anim.set_back_color(0x2222AA) +anim.set_bri(60) # set brightness to 40% var pulse = animate.pulse(0xFF4444, 2, 1) var osc1 = animate.oscillator(-3, 26, 5000, animate.COSINE) osc1.set_cb(pulse, pulse.set_pos) # animate color of pulse -var palette = animate.palette(animate.PALETTE_RAINBOW_WHITE, 30000) +var palette = animate.palette(animate.PALETTE_STANDARD_VAL, 30000) palette.set_cb(pulse, pulse.set_color) anim.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 9ac9c4c45..e75f5cbed 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_leds.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_leds.ino @@ -291,16 +291,16 @@ extern "C" { be_raise(vm, kTypeError, nullptr); } - static uint32_t ApplyBriGamma(uint32_t color_a /* 0xRRGGBB */, uint32_t bri /* 0..100 */, bool gamma) { + static uint32_t ApplyBriGamma(uint32_t color_a /* 0xRRGGBB */, uint32_t bri /* 0..255 */, 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 (bri < 255) { // apply bri + r = changeUIntScale(bri, 0, 255, 0, r); + g = changeUIntScale(bri, 0, 255, 0, g); + b = changeUIntScale(bri, 0, 255, 0, b); } if (gamma) { // apply gamma @@ -312,23 +312,23 @@ extern "C" { return rgb; } - // Leds.apply_bri_gamma(color_rgb:int (0xRRGGBB) [bri:int (0..100), gamma:bool]) -> color:int (0xRRGGBB) + // Leds.apply_bri_gamma(color_rgb:int (0xRRGGBB) [bri:int (0..255), 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; + uint32_t bri255 = 255; if (top >= 2 && be_isint(vm, 2)) { - bri = be_toint(vm, 2); + bri255 = be_toint(vm, 2); } bool gamma = false; if (top >= 3) { gamma = be_tobool(vm, 3); } - uint32_t rgb = ApplyBriGamma(color_a, bri, gamma); + uint32_t rgb = ApplyBriGamma(color_a, bri255, gamma); be_pushint(vm, rgb); be_return(vm); @@ -453,9 +453,9 @@ extern "C" { size_t dest_len = 0; uint8_t * dest_buf = (uint8_t*) be_tobytes(vm, 2, &dest_len); - uint32_t bri = 100; + uint32_t bri255 = 255; if (top >= 3 && be_isint(vm, 3)) { - bri = be_toint(vm, 3); + bri255 = be_toint(vm, 3); } bool gamma = false; if (top >= 4 && be_isbool(vm, 4)) { @@ -466,7 +466,7 @@ extern "C" { 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_argb = ApplyBriGamma(src_buf[i], bri255, gamma); uint32_t src_r = (src_argb >> 16) & 0xFF; uint32_t src_g = (src_argb >> 8) & 0xFF; uint32_t src_b = (src_argb ) & 0xFF;