-
-
Notifications
You must be signed in to change notification settings - Fork 508
Servo Control Feature (Rotating Frame) #598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9a17734
7cbfa7c
a484268
9b06fb6
ad1efc9
147147a
5be16f8
eeea237
d993f96
7aee95e
0248b5a
a500ce9
22613ef
33bf990
03d9930
eb51e3a
cca3aed
f701395
a69eaec
84c53f6
2e68b57
66451d0
6f9828f
79d6f0e
5980ca8
06835f2
f7640f7
310ea39
fe3427a
91ba62f
5c16757
6cf4e2d
3f933ce
418c115
95dfa97
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,4 +15,4 @@ psutil==7.0.0 | |
| cysystemd==2.0.1 | ||
| waitress==3.0.2 | ||
| feedparser==6.0.11 | ||
| astral>=3.1 | ||
| astral>=3.1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| gpiozero==2.0.1 | ||
| gpiod>=2.0.0 | ||
| lgpio==0.2.2.0 | ||
| RPi.GPIO==0.7.1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,14 +67,19 @@ def get_config(self, key=None, default={}): | |
| return self.config | ||
|
|
||
| def get_plugins(self): | ||
| """Returns the list of plugin configurations, sorted by custom order if set.""" | ||
| """Returns the list of plugin configurations, sorted by custom order if set. | ||
| Disables servo_control plugin if servo_enabled is false in config.""" | ||
| plugin_order = self.config.get('plugin_order', []) | ||
| servo_enabled = self.config.get('servo_enabled', False) | ||
|
|
||
| # Filter out servo_control plugin if servo is not enabled | ||
| filtered_plugins = [p for p in self.plugins_list if not (p['id'] == 'servo_control' and not servo_enabled)] | ||
|
|
||
| if not plugin_order: | ||
| return self.plugins_list | ||
| return filtered_plugins | ||
|
|
||
| # Create a dict for quick lookup | ||
| plugins_dict = {p['id']: p for p in self.plugins_list} | ||
| plugins_dict = {p['id']: p for p in filtered_plugins} | ||
|
|
||
|
Comment on lines
69
to
83
|
||
| # Build ordered list | ||
| ordered = [] | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -112,6 +112,6 @@ | |||||
| except: | ||||||
| pass # Ignore if we can't get the IP | ||||||
|
|
||||||
| serve(app, host="0.0.0.0", port=PORT, threads=1) | ||||||
| serve(app, listen="0.0.0.0:80 [::]:80", threads=1) | ||||||
|
||||||
| serve(app, listen="0.0.0.0:80 [::]:80", threads=1) | |
| serve(app, listen=f"0.0.0.0:{PORT} [::]:{PORT}", threads=1) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Servo Control Plugin | ||
|
|
||
| This Plugin provides control of a Servo motor connected to your Raspberry Pi via a configurable GPIO pin. | ||
| You can set the Target Angle and optional the orientation and Image Inversion saved in device_config. | ||
| Mainly this Plugin is intended to be used together with the Rotating Image Frame to create a physical frame rotation when displaying images. | ||
| But it could also be used for controlling other Mechanics (e.g. Windscreen Wipers, Blinds, etc.). | ||
|
|
||
| ## Rotating Image Frame Example | ||
|
|
||
| https://www.thingiverse.com/thing:7290592 | ||
|
|
||
| ### Parts Needed | ||
| - Raspberry Pi Zero 2 W | ||
| - Screen (tested with Pimoron Inky Impression - 7.3” Spectra 6 Edition) | ||
| - Powercable for Raspberry Pi | ||
| - Servo Motor (e.g. SG90) | ||
| - 18 Jumper Cables | ||
| - Rotating Frame Assembly 3D Print e.g. from Thingiverse (https://www.thingiverse.com/thing:7290592) | ||
| - Bearing (e.g. 8 mm x 22 mm x 7 mm) | ||
| - Frame (Ikea Roedalm - 200 mm x 150 mm) | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "display_name": "Servo Control", | ||
| "id": "servo_control", | ||
| "class": "ServoControl", | ||
| "repository": "" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update_config()attempts to appendservo_enabledby replacing the last}with,and then echoing a new key and another}. This produces invalid JSON (a standalone comma line / duplicated closing brace) for existing installs that don't already haveservo_enabled. Consider usingjq/python to edit JSON safely, or insert the new key before the final}while ensuring the previous property line gets the comma.