Skip to content

Commit

Permalink
prepare v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jackw01 committed Jan 27, 2021
1 parent 8344aa5 commit ecd9b00
Show file tree
Hide file tree
Showing 19 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 4 additions & 4 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ledcontrol/__init__.py
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
34 changes: 17 additions & 17 deletions ledcontrol/animationcontroller.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion ledcontrol/animationpatterns.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 8 additions & 8 deletions ledcontrol/app.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion ledcontrol/colorpalettes.py
Original file line number Diff line number Diff line change
@@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion ledcontrol/controlclient.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion ledcontrol/driver/__init__.py
Original file line number Diff line number Diff line change
@@ -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 *
Expand Down
2 changes: 1 addition & 1 deletion ledcontrol/driver/animation_utils.h
Original file line number Diff line number Diff line change
@@ -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__
Expand Down
2 changes: 1 addition & 1 deletion ledcontrol/driver/color_types.h
Original file line number Diff line number Diff line change
@@ -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__
Expand Down
2 changes: 1 addition & 1 deletion ledcontrol/driver/led_render.h
Original file line number Diff line number Diff line change
@@ -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__
Expand Down
2 changes: 1 addition & 1 deletion ledcontrol/ledcontroller.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion ledcontrol/pixelmappings.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion ledcontrol/static/css/index.scss
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
2 changes: 1 addition & 1 deletion ledcontrol/static/css/variables.scss
Original file line number Diff line number Diff line change
@@ -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%);
Expand Down
2 changes: 1 addition & 1 deletion ledcontrol/static/js/main.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion ledcontrol/utils.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit ecd9b00

Please sign in to comment.