diff options
author | jakob.stendahl <jakob.stendahl@infomedia.dk> | 2022-12-24 15:10:08 +0100 |
---|---|---|
committer | Jakob Stendahl <jakob.stendahl@outlook.com> | 2022-12-24 15:10:08 +0100 |
commit | 1457438493604b899e7929c95a3707b71e63f1e2 (patch) | |
tree | 896b537e3fded17458d314a91f3f89e240c92c4a | |
parent | c06882e58a7e30928ccf6366e4265548f54218c2 (diff) | |
download | Luxcena-Neo-1457438493604b899e7929c95a3707b71e63f1e2.tar.gz Luxcena-Neo-1457438493604b899e7929c95a3707b71e63f1e2.zip |
Fix bugs in builtin scripts
-rw-r--r-- | NeoRuntime/builtin/rainbow/script.py | 2 | ||||
-rw-r--r-- | NeoRuntime/builtin/running/script.py | 3 | ||||
-rw-r--r-- | NeoRuntime/builtin/static/script.py | 5 | ||||
-rw-r--r-- | NeoRuntime/builtin/strobe/script.py | 4 |
4 files changed, 8 insertions, 6 deletions
diff --git a/NeoRuntime/builtin/rainbow/script.py b/NeoRuntime/builtin/rainbow/script.py index 292ef97..fd9e21c 100644 --- a/NeoRuntime/builtin/rainbow/script.py +++ b/NeoRuntime/builtin/rainbow/script.py @@ -26,7 +26,7 @@ class Main(NeoBehaviour): def each_tick(self): """Draw rainbow that fades across all pixels at once.""" - if (perf_counter() - self.last_inst) > (1.01-self.var.Speed): + if (perf_counter() - self.last_inst) > (1.01-self.var.speed): self.last_inst = perf_counter() self.j += 1 if self.j >= 256: self.j = 0 diff --git a/NeoRuntime/builtin/running/script.py b/NeoRuntime/builtin/running/script.py index 24147ce..bc7849a 100644 --- a/NeoRuntime/builtin/running/script.py +++ b/NeoRuntime/builtin/running/script.py @@ -24,4 +24,5 @@ class Main(NeoBehaviour): int(((sin(i+self.position) * 127 + 128)/255)*self.green), int(((sin(i+self.position) * 127 + 128)/255)*self.blue)); self.last_inst = perf_counter() -
\ No newline at end of file + strip.show() + diff --git a/NeoRuntime/builtin/static/script.py b/NeoRuntime/builtin/static/script.py index 8916106..536ebe8 100644 --- a/NeoRuntime/builtin/static/script.py +++ b/NeoRuntime/builtin/static/script.py @@ -7,10 +7,11 @@ class Main(NeoBehaviour): def on_start(self): print("Script started, color: {}".format(self.var.color)) + + def each_tick(self): + self.set_color(self.var.color) def set_color(self, value): - print("Color var changed: {}".format(value)) - print(utils.detect_format_convert_color(value)) for i in range(strip.LED_COUNT): strip.set_pixel_color(i, value) strip.show() diff --git a/NeoRuntime/builtin/strobe/script.py b/NeoRuntime/builtin/strobe/script.py index cd5bffd..5d05bbd 100644 --- a/NeoRuntime/builtin/strobe/script.py +++ b/NeoRuntime/builtin/strobe/script.py @@ -4,7 +4,7 @@ from time import perf_counter class Main(NeoBehaviour): def declare_variables(self): - self.declare(FloatVariable("delay", 0.07, min_val=0.01, max_val=0.5, step=0.01)) + self.declare(FloatVariable("delay", 0.07, min_val=0.000001, max_val=0.5, step=0.000001)) self.declare(IntegerVariable("pause", 20, min_val=1, max_val=60)) self.declare(IntegerVariable("strobe count", 10, min_val=1, max_val=100)) self.declare(ColorVariable("color", "#fafafa")) @@ -31,4 +31,4 @@ class Main(NeoBehaviour): def set_all(*color): for i in range(strip.num_pixels()): strip.set_pixel_color(i, *color) - strip.show()
\ No newline at end of file + strip.show() |