From ecd9b00298b932d5916f6beaec632bf07947b8e5 Mon Sep 17 00:00:00 2001 From: jackw01 Date: Wed, 27 Jan 2021 10:07:22 -0800 Subject: [PATCH] prepare v1.1.0 --- LICENSE | 2 +- TODO.md | 8 +++---- ledcontrol/__init__.py | 2 +- ledcontrol/animationcontroller.py | 34 ++++++++++++++-------------- ledcontrol/animationpatterns.py | 2 +- ledcontrol/app.py | 16 ++++++------- ledcontrol/colorpalettes.py | 2 +- ledcontrol/controlclient.py | 2 +- ledcontrol/driver/__init__.py | 2 +- ledcontrol/driver/animation_utils.h | 2 +- ledcontrol/driver/color_types.h | 2 +- ledcontrol/driver/led_render.h | 2 +- ledcontrol/ledcontroller.py | 2 +- ledcontrol/pixelmappings.py | 2 +- ledcontrol/static/css/index.scss | 2 +- ledcontrol/static/css/variables.scss | 2 +- ledcontrol/static/js/main.js | 2 +- ledcontrol/utils.py | 2 +- setup.py | 2 +- 19 files changed, 45 insertions(+), 45 deletions(-) diff --git a/LICENSE b/LICENSE index 4a1dc5c..ed71f0a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018 jackw01 +Copyright (c) 2021 jackw01 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/TODO.md b/TODO.md index 979035e..0ff1e32 100644 --- a/TODO.md +++ b/TODO.md @@ -5,7 +5,7 @@ - [x] animation thread with proper waiting between cycles - [x] time and space dependent animations - [x] basic animations - hue cycle -- [x] master brightness and saturation control +- [x] brightness and saturation control - [x] basic secondary animations with scaling - [x] both number and slider inputs on UI - [x] command line arguments for configuration @@ -19,7 +19,7 @@ - [x] support all possible pixel orders and sk6812 - [x] test alternative color conversions in python - [x] LED color correction -- [x] master color temperature control +- [x] color temperature control - [x] make form generator code more pythonic - [x] web UI - migrate to SCSS - [x] web UI - flexbox @@ -40,7 +40,7 @@ - [x] web UI - allow inverting pattern scale - [x] web UI - update number inputs when sliders are moved - [x] rewrite final saturation/brightness in C -- [x] apply master saturation in RGB render mode +- [x] apply saturation in RGB render mode - [x] web UI - prevent editing default patterns - [x] web UI - copying and renaming patterns - [x] web UI - better color pickers @@ -56,7 +56,7 @@ #### 2019-10 - [x] automatically save settings - [x] general code cleanup and documentation -- [x] master brightness limiting +- [x] brightness limiting - [x] secondary patterns - wipe - [x] web UI - update code after changing patterns - [x] patterns - ripple diff --git a/ledcontrol/__init__.py b/ledcontrol/__init__.py index c724239..9958d86 100644 --- a/ledcontrol/__init__.py +++ b/ledcontrol/__init__.py @@ -1,5 +1,5 @@ # led-control WS2812B LED Controller Server -# Copyright 2019 jackw01. Released under the MIT License (see LICENSE for details). +# Copyright 2021 jackw01. Released under the MIT License (see LICENSE for details). __version__ = '1.0.0' diff --git a/ledcontrol/animationcontroller.py b/ledcontrol/animationcontroller.py index 4992cc0..e5157d0 100644 --- a/ledcontrol/animationcontroller.py +++ b/ledcontrol/animationcontroller.py @@ -1,5 +1,5 @@ # led-control WS2812B LED Controller Server -# Copyright 2019 jackw01. Released under the MIT License (see LICENSE for details). +# Copyright 2021 jackw01. Released under the MIT License (see LICENSE for details). import math import random @@ -94,10 +94,10 @@ def __init__(self, led_controller, refresh_rate, led_count, # Used to render main slider/select list self.params = { - 'master_brightness': 0.15, - 'master_color_temp': 6500, - 'master_gamma': 1.0, - 'master_saturation': 1.0, + 'brightness': 0.15, + 'color_temp': 6500, + 'gamma': 1.0, + 'saturation': 1.0, 'primary_pattern': 0, 'primary_speed': 0.2, 'primary_scale': 1.0, @@ -196,7 +196,7 @@ def reset_prev_states(self): def calculate_color_correction(self): 'Calculate and store color temperature correction' - rgb = driver.blackbody_to_rgb(self.params['master_color_temp']) + rgb = driver.blackbody_to_rgb(self.params['color_temp']) c = [self.correction_original[0] * int(rgb[0] * 255) // 255, self.correction_original[1] * int(rgb[1] * 255) // 255, self.correction_original[2] * int(rgb[2] * 255) // 255] @@ -234,7 +234,7 @@ def set_param(self, key, value): 'Set an animation parameter' self.params[key] = value self.update_needed = True - if key == 'master_color_temp': + if key == 'color_temp': self.calculate_color_correction() elif key == 'primary_scale' or key == 'secondary_scale': self.calculate_mappings() @@ -355,32 +355,32 @@ def update_leds(self): self.led_controller.set_all_pixels_hsv_float( [(c[0][0] % 1, c[0][1], c[0][2] * c[1]) for c in s_2], self.correction, - self.params['master_saturation'], - self.params['master_brightness'], - self.params['master_gamma'] + self.params['saturation'], + self.params['brightness'], + self.params['gamma'] ) elif mode == animpatterns.ColorMode.rgb: self.led_controller.set_all_pixels_rgb_float( [(c[0][0] * c[1], c[0][1] * c[1], c[0][2] * c[1]) for c in s_2], self.correction, - self.params['master_saturation'], - self.params['master_brightness'], - self.params['master_gamma'] + self.params['saturation'], + self.params['brightness'], + self.params['gamma'] ) # If displaying a static pattern with no secondary pattern, brightness is 0, # or speed is 0: no update is needed the next frame self.update_needed = not ( - ((self.params['primary_pattern'] in animpatterns.static_patterns or self.params['primary_speed'] == 0) and self.params['secondary_pattern'] == 0) or self.params['master_brightness'] == 0) + ((self.params['primary_pattern'] in animpatterns.static_patterns or self.params['primary_speed'] == 0) and self.params['secondary_pattern'] == 0) or self.params['brightness'] == 0) def clear_leds(self): 'Turn all LEDs off' self.led_controller.set_all_pixels_rgb_float( [(0, 0, 0) for i in range(self.led_count)], self.correction, - self.params['master_saturation'], - self.params['master_brightness'], - self.params['master_gamma'] + self.params['saturation'], + self.params['brightness'], + self.params['gamma'] ) def end_animation(self): diff --git a/ledcontrol/animationpatterns.py b/ledcontrol/animationpatterns.py index 862e675..d95f225 100644 --- a/ledcontrol/animationpatterns.py +++ b/ledcontrol/animationpatterns.py @@ -1,5 +1,5 @@ # led-control WS2812B LED Controller Server -# Copyright 2019 jackw01. Released under the MIT License (see LICENSE for details). +# Copyright 2021 jackw01. Released under the MIT License (see LICENSE for details). from random import random from enum import Enum diff --git a/ledcontrol/app.py b/ledcontrol/app.py index 08933cb..7371ecb 100644 --- a/ledcontrol/app.py +++ b/ledcontrol/app.py @@ -1,5 +1,5 @@ # led-control WS2812B LED Controller Server -# Copyright 2019 jackw01. Released under the MIT License (see LICENSE for details). +# Copyright 2021 jackw01. Released under the MIT License (see LICENSE for details). import json import atexit @@ -47,10 +47,10 @@ def create_app(led_count, refresh_rate, # Init controller params and custom patterns from settings file with open(str(filename), mode='r') as data_file: try: - settings = json.load(data_file) + settings = json.loads(data_file.read().replace('master_', '')) # Enforce brightness limit - settings['params']['master_brightness'] = min( - settings['params']['master_brightness'], led_v_limit) + settings['params']['brightness'] = min( + settings['params']['brightness'], led_v_limit) # Set controller params, recalculate things that depend on params controller.params.update(settings['params']) controller.params['direct_control_mode'] = 0 @@ -73,10 +73,10 @@ def create_app(led_count, refresh_rate, # Define form and create user-facing labels based on keys form = [ - FormItem('range', 'master_brightness', float, 0, led_v_limit, 0.05), - FormItem('range', 'master_color_temp', int, 1000, 12000, 10, unit='K'), - #FormItem('range', 'master_gamma', float, 0.01, 3), - FormItem('range', 'master_saturation', float, 0, 1), + FormItem('range', 'brightness', float, 0, led_v_limit, 0.05), + FormItem('range', 'color_temp', int, 1000, 12000, 10, unit='K'), + #FormItem('range', 'gamma', float, 0.01, 3), + FormItem('range', 'saturation', float, 0, 1), FormItem('select', 'primary_pattern', int), FormItem('range', 'primary_speed', float, 0, 2, unit='Hz'), FormItem('range', 'primary_scale', float, -10, 10), diff --git a/ledcontrol/colorpalettes.py b/ledcontrol/colorpalettes.py index 2dcedee..d726806 100644 --- a/ledcontrol/colorpalettes.py +++ b/ledcontrol/colorpalettes.py @@ -1,5 +1,5 @@ # led-control WS2812B LED Controller Server -# Copyright 2020 jackw01. Released under the MIT License (see LICENSE for details). +# Copyright 2021 jackw01. Released under the MIT License (see LICENSE for details). default = { 0: { diff --git a/ledcontrol/controlclient.py b/ledcontrol/controlclient.py index f08ab30..91c75a9 100644 --- a/ledcontrol/controlclient.py +++ b/ledcontrol/controlclient.py @@ -1,5 +1,5 @@ # led-control WS2812B LED Controller Server -# Copyright 2020 jackw01. Released under the MIT License (see LICENSE for details). +# Copyright 2021 jackw01. Released under the MIT License (see LICENSE for details). import ujson diff --git a/ledcontrol/driver/__init__.py b/ledcontrol/driver/__init__.py index 5015e55..e843ec7 100644 --- a/ledcontrol/driver/__init__.py +++ b/ledcontrol/driver/__init__.py @@ -1,5 +1,5 @@ # led-control WS2812B LED Controller Server -# Copyright 2020 jackw01. Released under the MIT License (see LICENSE for details). +# Copyright 2021 jackw01. Released under the MIT License (see LICENSE for details). # Import the extension module from _ledcontrol_rpi_ws281x_driver import * diff --git a/ledcontrol/driver/animation_utils.h b/ledcontrol/driver/animation_utils.h index 039bddf..e14155c 100644 --- a/ledcontrol/driver/animation_utils.h +++ b/ledcontrol/driver/animation_utils.h @@ -1,5 +1,5 @@ // led-control WS2812B LED Controller Server -// Copyright 2019 jackw01. Released under the MIT License (see LICENSE for details). +// Copyright 2021 jackw01. Released under the MIT License (see LICENSE for details). #ifndef __ANIMATION_UTILS_H__ #define __ANIMATION_UTILS_H__ diff --git a/ledcontrol/driver/color_types.h b/ledcontrol/driver/color_types.h index a915c3e..478ab09 100644 --- a/ledcontrol/driver/color_types.h +++ b/ledcontrol/driver/color_types.h @@ -1,5 +1,5 @@ // led-control WS2812B LED Controller Server -// Copyright 2019 jackw01. Released under the MIT License (see LICENSE for details). +// Copyright 2021 jackw01. Released under the MIT License (see LICENSE for details). #ifndef __COLOR_TYPES_H__ #define __COLOR_TYPES_H__ diff --git a/ledcontrol/driver/led_render.h b/ledcontrol/driver/led_render.h index 2dd32b2..4e9bc3c 100644 --- a/ledcontrol/driver/led_render.h +++ b/ledcontrol/driver/led_render.h @@ -1,5 +1,5 @@ // led-control WS2812B LED Controller Server -// Copyright 2019 jackw01. Released under the MIT License (see LICENSE for details). +// Copyright 2021 jackw01. Released under the MIT License (see LICENSE for details). #ifndef __LED_RENDER_H__ #define __LED_RENDER_H__ diff --git a/ledcontrol/ledcontroller.py b/ledcontrol/ledcontroller.py index 7c00f8b..0358934 100644 --- a/ledcontrol/ledcontroller.py +++ b/ledcontrol/ledcontroller.py @@ -1,5 +1,5 @@ # led-control WS2812B LED Controller Server -# Copyright 2019 jackw01. Released under the MIT License (see LICENSE for details). +# Copyright 2021 jackw01. Released under the MIT License (see LICENSE for details). import atexit diff --git a/ledcontrol/pixelmappings.py b/ledcontrol/pixelmappings.py index e9a466f..6711ff3 100644 --- a/ledcontrol/pixelmappings.py +++ b/ledcontrol/pixelmappings.py @@ -1,5 +1,5 @@ # led-control WS2812B LED Controller Server -# Copyright 2019 jackw01. Released under the MIT License (see LICENSE for details). +# Copyright 2021 jackw01. Released under the MIT License (see LICENSE for details). import collections diff --git a/ledcontrol/static/css/index.scss b/ledcontrol/static/css/index.scss index acec3b9..8e8901d 100644 --- a/ledcontrol/static/css/index.scss +++ b/ledcontrol/static/css/index.scss @@ -1,5 +1,5 @@ // led-control WS2812B LED Controller Server -// Copyright 2019 jackw01. Released under the MIT License (see LICENSE for details). +// Copyright 2021 jackw01. Released under the MIT License (see LICENSE for details). @import "variables"; diff --git a/ledcontrol/static/css/variables.scss b/ledcontrol/static/css/variables.scss index b98a22b..ee8db40 100644 --- a/ledcontrol/static/css/variables.scss +++ b/ledcontrol/static/css/variables.scss @@ -1,5 +1,5 @@ // led-control WS2812B LED Controller Server -// Copyright 2019 jackw01. Released under the MIT License (see LICENSE for details). +// Copyright 2021 jackw01. Released under the MIT License (see LICENSE for details). $color-accent: #06a2ab; $color-accent-lighter: lighten($color-accent, 7%); diff --git a/ledcontrol/static/js/main.js b/ledcontrol/static/js/main.js index 2fc955f..422bd9b 100644 --- a/ledcontrol/static/js/main.js +++ b/ledcontrol/static/js/main.js @@ -1,5 +1,5 @@ // led-control WS2812B LED Controller Server -// Copyright 2019 jackw01. Released under the MIT License (see LICENSE for details). +// Copyright 2021 jackw01. Released under the MIT License (see LICENSE for details). // Really should have used React or Vue for this but from my experience it would likely not build on a Raspberry Pi Zero due to the RAM limit // Enjoy my jquery spaghetti code lol diff --git a/ledcontrol/utils.py b/ledcontrol/utils.py index dcfbd44..62692ba 100644 --- a/ledcontrol/utils.py +++ b/ledcontrol/utils.py @@ -1,5 +1,5 @@ # led-control WS2812B LED Controller Server -# Copyright 2019 jackw01. Released under the MIT License (see LICENSE for details). +# Copyright 2021 jackw01. Released under the MIT License (see LICENSE for details). import re import math diff --git a/setup.py b/setup.py index 4387787..92aacba 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ def run(self): setup( name='led-control', - version='1.0.0', + version='1.1.0', description='WS2812 LED strip controller with web interface for Raspberry Pi', long_description=open('README.md').read(), long_description_content_type='text/markdown',