From 15d72e9f336259d932fbec0367a03a42177e9417 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Fri, 8 Dec 2023 22:41:44 +0100 Subject: [PATCH] Fix solidification of leds (#20199) * Fix solidification of leds * Fix includes --- lib/libesp32/berry_tasmota/solidify_all.be | 27 ++++++++++++++----- .../src/be_leds_animator_class.c | 2 +- .../berry_tasmota/src/be_leds_pulse_class.c | 2 +- .../{leds_animator.be => leds_0_animator.be} | 0 ...e_effects.be => leds_1_animate_effects.be} | 0 ...nimator.h => solidified_leds_0_animator.h} | 2 +- ....h => solidified_leds_1_animate_effects.h} | 2 +- 7 files changed, 25 insertions(+), 10 deletions(-) rename lib/libesp32/berry_tasmota/src/embedded/{leds_animator.be => leds_0_animator.be} (100%) rename lib/libesp32/berry_tasmota/src/embedded/{leds_animate_effects.be => leds_1_animate_effects.be} (100%) rename lib/libesp32/berry_tasmota/src/solidify/{solidified_leds_animator.h => solidified_leds_0_animator.h} (99%) rename lib/libesp32/berry_tasmota/src/solidify/{solidified_leds_animate_effects.h => solidified_leds_1_animate_effects.h} (99%) diff --git a/lib/libesp32/berry_tasmota/solidify_all.be b/lib/libesp32/berry_tasmota/solidify_all.be index bf2ebfc6a..8961f50af 100755 --- a/lib/libesp32/berry_tasmota/solidify_all.be +++ b/lib/libesp32/berry_tasmota/solidify_all.be @@ -5,7 +5,7 @@ import os import global import solidify -import string +import string as string2 import re import sys @@ -18,13 +18,27 @@ var globs = "path,ctypes_bytes_dyn,tasmota,ccronexpr,gpio,light,webclient,load,M "_lvgl," "int64" -for g:string.split(globs, ",") +for g:string2.split(globs, ",") global.(g) = nil end var prefix_dir = "src/embedded/" var prefix_out = "src/solidify/" +def sort(l) + # insertion sort + for i:1..size(l)-1 + var k = l[i] + var j = i + while (j > 0) && (l[j-1] > k) + l[j] = l[j-1] + j -= 1 + end + l[j] = k + end + return l +end + def clean_directory(dir) var file_list = os.listdir(dir) for f : file_list @@ -44,9 +58,9 @@ def parse_file(fname, prefix_out) var compiled = compile(src) compiled() # run the compile code to instanciate the classes and modules # output solidified - var fname_h = string.split(fname, '.be')[0] + '.h' # take whatever is before the first '.be' + var fname_h = string2.split(fname, '.be')[0] + '.h' # take whatever is before the first '.be' var fout = open(prefix_out + "solidified_" + fname_h, "w") - fout.write(format("/* Solidification of %s */\n", fname_h)) + fout.write(f"/* Solidification of {fname_h} */\n") fout.write("/********************************************************************\\\n") fout.write("* Generated code, don't edit *\n") fout.write("\\********************************************************************/\n") @@ -56,13 +70,13 @@ def parse_file(fname, prefix_out) # print(directives) for directive : directives - var object_list = string.split(directive[1], ',') + var object_list = string2.split(directive[1], ',') var object_name = object_list[0] var weak = (object_list.find('weak') != nil) # do we solidify with weak strings? var o = global var cl_name = nil var obj_name = nil - for subname : string.split(object_name, '.') + for subname : string2.split(object_name, '.') o = o.(subname) cl_name = obj_name obj_name = subname @@ -78,6 +92,7 @@ end clean_directory(prefix_out) var src_file_list = os.listdir(prefix_dir) +src_file_list = sort(src_file_list) for src_file : src_file_list if src_file[0] == '.' continue end parse_file(src_file, prefix_out) diff --git a/lib/libesp32/berry_tasmota/src/be_leds_animator_class.c b/lib/libesp32/berry_tasmota/src/be_leds_animator_class.c index 2c4f80ee8..3bf10367a 100644 --- a/lib/libesp32/berry_tasmota/src/be_leds_animator_class.c +++ b/lib/libesp32/berry_tasmota/src/be_leds_animator_class.c @@ -4,6 +4,6 @@ *******************************************************************/ #ifdef USE_WS2812 -#include "solidify/solidified_leds_animator.h" +#include "solidify/solidified_leds_0_animator.h" #endif // USE_WS2812 diff --git a/lib/libesp32/berry_tasmota/src/be_leds_pulse_class.c b/lib/libesp32/berry_tasmota/src/be_leds_pulse_class.c index 5b6e15bff..3a2753b56 100644 --- a/lib/libesp32/berry_tasmota/src/be_leds_pulse_class.c +++ b/lib/libesp32/berry_tasmota/src/be_leds_pulse_class.c @@ -4,6 +4,6 @@ *******************************************************************/ #ifdef USE_WS2812 -#include "solidify/solidified_leds_animate_effects.h" +#include "solidify/solidified_leds_1_animate_effects.h" #endif // USE_WS2812 diff --git a/lib/libesp32/berry_tasmota/src/embedded/leds_animator.be b/lib/libesp32/berry_tasmota/src/embedded/leds_0_animator.be similarity index 100% rename from lib/libesp32/berry_tasmota/src/embedded/leds_animator.be rename to lib/libesp32/berry_tasmota/src/embedded/leds_0_animator.be diff --git a/lib/libesp32/berry_tasmota/src/embedded/leds_animate_effects.be b/lib/libesp32/berry_tasmota/src/embedded/leds_1_animate_effects.be similarity index 100% rename from lib/libesp32/berry_tasmota/src/embedded/leds_animate_effects.be rename to lib/libesp32/berry_tasmota/src/embedded/leds_1_animate_effects.be diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_animator.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_0_animator.h similarity index 99% rename from lib/libesp32/berry_tasmota/src/solidify/solidified_leds_animator.h rename to lib/libesp32/berry_tasmota/src/solidify/solidified_leds_0_animator.h index 159dc5df2..ea031d397 100644 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_animator.h +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_0_animator.h @@ -1,4 +1,4 @@ -/* Solidification of leds_animator.h */ +/* Solidification of leds_0_animator.h */ /********************************************************************\ * Generated code, don't edit * \********************************************************************/ diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_animate_effects.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_1_animate_effects.h similarity index 99% rename from lib/libesp32/berry_tasmota/src/solidify/solidified_leds_animate_effects.h rename to lib/libesp32/berry_tasmota/src/solidify/solidified_leds_1_animate_effects.h index 63e971fdd..1c2891e5b 100644 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_animate_effects.h +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_1_animate_effects.h @@ -1,4 +1,4 @@ -/* Solidification of leds_animate_effects.h */ +/* Solidification of leds_1_animate_effects.h */ /********************************************************************\ * Generated code, don't edit * \********************************************************************/