mirror of https://github.com/arendst/Tasmota.git
Fix solidification of leds (#20199)
* Fix solidification of leds * Fix includes
This commit is contained in:
parent
d61adb0b0c
commit
15d72e9f33
|
@ -5,7 +5,7 @@
|
||||||
import os
|
import os
|
||||||
import global
|
import global
|
||||||
import solidify
|
import solidify
|
||||||
import string
|
import string as string2
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
@ -18,13 +18,27 @@ var globs = "path,ctypes_bytes_dyn,tasmota,ccronexpr,gpio,light,webclient,load,M
|
||||||
"_lvgl,"
|
"_lvgl,"
|
||||||
"int64"
|
"int64"
|
||||||
|
|
||||||
for g:string.split(globs, ",")
|
for g:string2.split(globs, ",")
|
||||||
global.(g) = nil
|
global.(g) = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
var prefix_dir = "src/embedded/"
|
var prefix_dir = "src/embedded/"
|
||||||
var prefix_out = "src/solidify/"
|
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)
|
def clean_directory(dir)
|
||||||
var file_list = os.listdir(dir)
|
var file_list = os.listdir(dir)
|
||||||
for f : file_list
|
for f : file_list
|
||||||
|
@ -44,9 +58,9 @@ def parse_file(fname, prefix_out)
|
||||||
var compiled = compile(src)
|
var compiled = compile(src)
|
||||||
compiled() # run the compile code to instanciate the classes and modules
|
compiled() # run the compile code to instanciate the classes and modules
|
||||||
# output solidified
|
# 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")
|
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("/********************************************************************\\\n")
|
||||||
fout.write("* Generated code, don't edit *\n")
|
fout.write("* Generated code, don't edit *\n")
|
||||||
fout.write("\\********************************************************************/\n")
|
fout.write("\\********************************************************************/\n")
|
||||||
|
@ -56,13 +70,13 @@ def parse_file(fname, prefix_out)
|
||||||
# print(directives)
|
# print(directives)
|
||||||
|
|
||||||
for directive : 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 object_name = object_list[0]
|
||||||
var weak = (object_list.find('weak') != nil) # do we solidify with weak strings?
|
var weak = (object_list.find('weak') != nil) # do we solidify with weak strings?
|
||||||
var o = global
|
var o = global
|
||||||
var cl_name = nil
|
var cl_name = nil
|
||||||
var obj_name = nil
|
var obj_name = nil
|
||||||
for subname : string.split(object_name, '.')
|
for subname : string2.split(object_name, '.')
|
||||||
o = o.(subname)
|
o = o.(subname)
|
||||||
cl_name = obj_name
|
cl_name = obj_name
|
||||||
obj_name = subname
|
obj_name = subname
|
||||||
|
@ -78,6 +92,7 @@ end
|
||||||
clean_directory(prefix_out)
|
clean_directory(prefix_out)
|
||||||
|
|
||||||
var src_file_list = os.listdir(prefix_dir)
|
var src_file_list = os.listdir(prefix_dir)
|
||||||
|
src_file_list = sort(src_file_list)
|
||||||
for src_file : src_file_list
|
for src_file : src_file_list
|
||||||
if src_file[0] == '.' continue end
|
if src_file[0] == '.' continue end
|
||||||
parse_file(src_file, prefix_out)
|
parse_file(src_file, prefix_out)
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
#ifdef USE_WS2812
|
#ifdef USE_WS2812
|
||||||
|
|
||||||
#include "solidify/solidified_leds_animator.h"
|
#include "solidify/solidified_leds_0_animator.h"
|
||||||
|
|
||||||
#endif // USE_WS2812
|
#endif // USE_WS2812
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
#ifdef USE_WS2812
|
#ifdef USE_WS2812
|
||||||
|
|
||||||
#include "solidify/solidified_leds_animate_effects.h"
|
#include "solidify/solidified_leds_1_animate_effects.h"
|
||||||
|
|
||||||
#endif // USE_WS2812
|
#endif // USE_WS2812
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Solidification of leds_animator.h */
|
/* Solidification of leds_0_animator.h */
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* Generated code, don't edit *
|
* Generated code, don't edit *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
|
@ -1,4 +1,4 @@
|
||||||
/* Solidification of leds_animate_effects.h */
|
/* Solidification of leds_1_animate_effects.h */
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* Generated code, don't edit *
|
* Generated code, don't edit *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
Loading…
Reference in New Issue