Skip to content

Commit 76216b4

Browse files
committed
Merge branch '0.7.x'
2 parents ab6cd3e + 9c4fc19 commit 76216b4

File tree

6 files changed

+112
-21
lines changed

6 files changed

+112
-21
lines changed

docs/configuration/printing-effects.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ All the standard effects available, with fancy visualisations!
3535

3636
Sets all LEDs to one colour, forever.
3737

38-
![](../.gitbook/assets/solid_colour%20%283%29.gif)
38+
![](../.gitbook/assets/solid_colour%20%284%29.gif)
3939

4040
### Colour Wipe
4141

4242
Wipes colour across the strip pixel by pixel, then clears it pixel by pixel.
4343

44-
![](../.gitbook/assets/color_wipe%20%282%29.gif)
44+
![](../.gitbook/assets/color_wipe%20%284%29.gif)
4545

4646
### Colour Wipe V2
4747

@@ -53,13 +53,13 @@ Wipes colour pixel by pixel, as above, but to clear it turns around and heads ba
5353

5454
Fades brightness up and down. Looks better in real life than the visualisation below!
5555

56-
![](../.gitbook/assets/pulse%20%281%29.gif)
56+
![](../.gitbook/assets/pulse%20%283%29%20%281%29.gif)
5757

5858
### Bounce
5959

6060
Sends a pulse of light bouncing from one side of your strip to the other.
6161

62-
![](../.gitbook/assets/bounce%20%283%29.gif)
62+
![](../.gitbook/assets/bounce%20%282%29%20%281%29.gif)
6363

6464
### Solo Bounce
6565

@@ -71,13 +71,13 @@ Sends just a single pixel from one side to the other, bouncing about.
7171

7272
Cycles all the LEDs through the rainbow together.
7373

74-
![](../.gitbook/assets/rainbow%20%281%29.gif)
74+
![](../.gitbook/assets/rainbow%20%282%29%20%281%29.gif)
7575

7676
### Rainbow Cycle
7777

7878
Rainbow that cycles across the strip, so a full rainbow is across the whole strip at once.
7979

80-
![](../.gitbook/assets/rainbow_cycle%20%283%29.gif)
80+
![](../.gitbook/assets/rainbow_cycle%20%282%29%20%281%29.gif)
8181

8282
### Crossover
8383

@@ -89,7 +89,7 @@ Two pixels bouncing in opposite directions, crossing over in the middle.
8989

9090
Sets all LEDs to a random colour, then changes a random pixel, to a new random colour
9191

92-
![](../.gitbook/assets/random%20%281%29.gif)
92+
![](../.gitbook/assets/random%20%283%29%20%281%29.gif)
9393

9494
### Bouncy Balls
9595

docs/documentation/m150-intercept.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,11 @@ M150 W100 # Sets to white, at 100 intensity
3131
M150 R255 P200 # Sets LEDs to red, at 200 brightness
3232
```
3333

34+
## What does the W parameter do?
35+
36+
On a standard RGB WS281x strip, the W parameter sets an equal value of R, G and B on the LEDs.
37+
38+
If you have an RGBW strip and enable the 'Use dedicated white' setting, the W parameter will control the white LEDs only.
39+
40+
Sending any of R, G or B with the command takes priority over the W.
41+

docs/documentation/rest-api.md

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,88 @@ description: >-
66

77
# REST API
88

9-
{% hint style="danger" %}
10-
The API of the plugin is currently undocumented and **it will change in version 0.7.0 of this plugin.** From that point onwards I will aim to have a stable, documented API.
9+
The plugin implements a [SimpleAPI as provided by OctoPrint](https://docs.octoprint.org/en/devel/plugins/mixins.html#simpleapiplugin), which enables external access to the plugin's functionality.
10+
11+
It has a single endpoint, supporting a get request and posting a command.
12+
13+
{% api-method method="get" host="http://octopi.local" path="/api/plugin/ws281x\_led\_status" %}
14+
{% api-method-summary %}
15+
SimpleAPI Get
16+
{% endapi-method-summary %}
17+
18+
{% api-method-description %}
19+
Get current state of the plugin, which includes the light status and the torch status.
20+
{% endapi-method-description %}
21+
22+
{% api-method-spec %}
23+
{% api-method-request %}
24+
{% api-method-headers %}
25+
{% api-method-parameter name="X-Api-Key" type="string" required=true %}
26+
A valid OctoPrint API key.
27+
{% endapi-method-parameter %}
28+
{% endapi-method-headers %}
29+
{% endapi-method-request %}
30+
31+
{% api-method-response %}
32+
{% api-method-response-example httpCode=200 %}
33+
{% api-method-response-example-description %}
34+
Details of the plugin's current state
35+
{% endapi-method-response-example-description %}
36+
37+
```javascript
38+
{
39+
"lights_on": false,
40+
"torch_on": false
41+
}
42+
```
43+
{% endapi-method-response-example %}
44+
{% endapi-method-response %}
45+
{% endapi-method-spec %}
46+
{% endapi-method %}
47+
48+
{% api-method method="post" host="http://octopi.local" path="/api/plugin/ws281x\_led\_status" %}
49+
{% api-method-summary %}
50+
SimpleAPI Command
51+
{% endapi-method-summary %}
52+
53+
{% api-method-description %}
54+
Send commands to the plugin, to make it do something.
55+
{% endapi-method-description %}
56+
57+
{% api-method-spec %}
58+
{% api-method-request %}
59+
{% api-method-headers %}
60+
{% api-method-parameter name="X-Api-Key" type="string" required=true %}
61+
A valid OctoPrint API key
62+
{% endapi-method-parameter %}
63+
{% endapi-method-headers %}
64+
65+
{% api-method-body-parameters %}
66+
{% api-method-parameter name="command" type="string" required=true %}
67+
The command to be sent to the plugin. See commands below.
68+
{% endapi-method-parameter %}
69+
{% endapi-method-body-parameters %}
70+
{% endapi-method-request %}
71+
72+
{% api-method-response %}
73+
{% api-method-response-example httpCode=200 %}
74+
{% api-method-response-example-description %}
75+
76+
{% endapi-method-response-example-description %}
77+
78+
```javascript
79+
{
80+
"lights_on": false,
81+
"torch_on": false
82+
}
83+
```
84+
{% endapi-method-response-example %}
85+
{% endapi-method-response %}
86+
{% endapi-method-spec %}
87+
{% endapi-method %}
88+
89+
{% hint style="info" %}
90+
See also the [SimpleApi docs](https://docs.octoprint.org/en/devel/plugins/mixins.html#octoprint.plugin.SimpleApiPlugin) for details about how the request should be structured.
1191
{% endhint %}
1292

1393

docs/guides/setup-guide-1/wiring-your-leds.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Wiring is as follows:
3939
Make sure you have a common ground between the power supply and Pi.
4040
{% endhint %}
4141

42-
![Wiring with no shifter](../../.gitbook/assets/wiring_no_shift%20%282%29.png)
42+
![Wiring with no shifter](../../.gitbook/assets/wiring_no_shift%20%283%29%20%281%29.png)
4343

4444
### Level Shifting Chip
4545

octoprint_ws281x_led_status/effects/standard.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,17 @@ def set_pixel(pixel, pixel_color):
6565

6666

6767
def simple_pulse(strip, queue, color, delay, brightness_manager, *args, **kwargs):
68+
max_brightness = brightness_manager.max_brightness
69+
solid_color(
70+
strip=strip,
71+
queue=queue,
72+
color=color,
73+
brightness_manager=brightness_manager,
74+
wait=False,
75+
)
76+
6877
while True:
69-
max_brightness = brightness_manager.max_brightness
7078
brightness_manager.set_brightness(1)
71-
solid_color(
72-
strip=strip,
73-
queue=queue,
74-
color=color,
75-
brightness_manager=brightness_manager,
76-
wait=False,
77-
)
7879

7980
for direction in DIRECTIONS:
8081
for b in (
@@ -208,7 +209,7 @@ def blink(strip, queue, color, delay, brightness_manager, *args, **kwargs):
208209
brightness_manager=brightness_manager,
209210
wait=False,
210211
)
211-
for _ms in range(int(delay / 2)):
212+
for _ms in range(int(delay) // 2):
212213
if not q_poll_milli_sleep(2, queue):
213214
# We do it this way so we can check the q more often, as for blink
214215
# delay may be high. Otherwise the effect may end up blocking the

octoprint_ws281x_led_status/static/js/ws281x_led_status.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Copyright (c) Charlie Powell 2020-2021 - released under the terms of the AGPLv3 License
55
*/
66

7-
const ko = window.ko;
7+
let ko = window.ko;
88

99
$(function () {
1010
function ws281xLedStatusNavbarViewModel(parameters) {
@@ -155,7 +155,9 @@ $(function () {
155155
};
156156

157157
self.sendTestCommand = function (color) {
158-
OctoPrint.simpleApiCommand("ws281x_led_status", "test_led", { color } );
158+
OctoPrint.simpleApiCommand("ws281x_led_status", "test_led", {
159+
color,
160+
});
159161
};
160162

161163
self.advancedStripOpen = ko.observable(false);

0 commit comments

Comments
 (0)