Merging updates from gentnerlab into our master branch.#2
Open
Lathomas42 wants to merge 132 commits into
Open
Conversation
adding support for Arduino
switch to BSD license
Double staircase
derisking the pyaudio callback
added new free food block branch to to merge with newer commits of ma…
replaced class_assoc with a port lookup
* Raspberry pi devices * Hopper/feed * PWM interfaces * PWM houslight * Fixing houselights * minor * audio * sound works * raspi updates * raspi updates * starting development again * updates for raspi behaviors * box rev3 working * Added hostname switch for comedi extension * allsummary * parenthesis * hostname * change readme * add glab_behaviors * houselight update * emails * remove allsummary script from setup.py
- local.py now reads /etc/magpi_revision to distinguish Rev C from Rev D boards, rather than relying on hostname alone. Raises RuntimeError with a clear message if the file is missing or unrecognised. - local_pi_revc.py: Rev C config with solenoid hopper on GPIO 16 - local_pi_revd.py: Rev D config with servo hopper on PCA9685 U7 (0x4A) - components.py: unified Hopper class accepts either solenoid (BooleanOutput) or servo (PWMOutput + up_angle + down_angle); validates at construction time - local_pi.py removed
pyoperant/interfaces/raspi_gpio_.py Remove hardcoded PCA9685 module-level address constants Require lights_address and servo_address to be passed explicitly to RaspberryPiInterface.__init__; raise InterfaceError if lights_address is missing Only initialise servo PWM chip if servo_address is provided (None on Rev C) Add guard in _write_pwm to raise InterfaceError if servo PWM is attempted without a servo chip Fix _read_bool: add missing raise in exception handler (was silently swallowing GPIO read errors and spinning forever) pyoperant/components.py Fix RGBLight.__init__: accept PWMOutput as well as BooleanOutput for red/green/blue channels (was crashing on instantiation on all Rev D panels) Fix PeckPort LED isinstance check: if/if/else → if/elif/else (was raising ValueError for any BooleanOutput LED) pyoperant/local_pi_revd.py Add LIGHTS_PCA9685_ADDRESS = 0x55 and SERVO_PCA9685_ADDRESS = 0x45 as single source of truth for both chip addresses Correct servo chip address throughout: 0x4A → 0x45 (A0 and A2 pulled high, not A1 and A3) Pass address constants explicitly to RaspberryPiInterface Fix RGB cue light index comment for consistency with comment block above pyoperant/local_pi_revc.py Add LIGHTS_PCA9685_ADDRESS = 0x55 constant Pass lights_address explicitly to RaspberryPiInterface; no servo_address (Rev C has no servo chip) scripts/tune_servo.py (new) Interactive servo angle tuning script for Rev D panels Jog servo by duty cycle, read IR beam status, set and verify up/down angles, run full feed cycle, print final constructor call for local_pi_revd.py setup.py Add scripts/tune_servo.py to installed scripts
Add # -*- coding: utf-8 -*- to all Python 2 files containing non-ASCII characters (components.py, raspi_gpio_.py, local_pi.py, local_pi_revc.py, local_pi_revd.py) to prevent SyntaxError on import. Also fix missing self.left PeckPort assignment in local_pi_revd.py and expand PiPanel.test() to exercise house light, RGB cue light, peck port LEDs, and IR sensors with per-component pass/fail reporting. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Switch _write_pwm to convert degrees (0-300) to pulse width in microseconds using goBILDA 2000-0025-0002 spec (500us-2500us) - Fix pigpio connection to use default port instead of hardcoded 7777 - Correct hopper IR beam polarity: high=broken, so inverted=False - Update tune_servo.py: degree range 0-300, raw_input for Python 2, IR beam logic fixed to match hardware (broken = raw, not not raw) - Update Hopper docstring to reflect degree-based angles Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Move BasePanel.test() to panels.py with two-phase autonomous + user confirmation sequence; peck port IR check uses status() polling loop to correctly handle inverted beam logic - Fix Hopper.up() to poll check() in a loop instead of wait_for_edge, avoiding missed edges on slow-moving servos - Default max_lag to 1.0s for servo hoppers and 0.3s for solenoids - Add scripts/test_panel.py: detects board revision from /etc/magpi_revision, initialises panel, waits for user confirmation before running test - Add scripts/test_ir.py: live readout of all 10 IR sensor states - Remove per-panel test() from local_pi_revd.py and local_pi_revc.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add import time to components.py (required by Hopper.up() polling loop) - Fix peck port inverted flag to False in local_pi_revd.py — Rev D IR sensors read HIGH when beam broken, same as hopper - Clean up panels.py import ordering and minor comment additions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Update read_ir() docstring to reflect confirmed Rev D polarity: high = beam broken, inverted=False throughout. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
22 tests covering max_lag defaults, constructor validation, IR polarity, up/down/feed cycle logic — runnable on dev machines via FakeInterface stub. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary print statement had inverted=True; Rev D uses inverted=False for all sensors (beam broken = GPIO HIGH). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pyoperant servo hopper mods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Going to create this pull request to see the merge conflicts