Skip to content

Merging updates from gentnerlab into our master branch.#2

Open
Lathomas42 wants to merge 132 commits into
theunissenlab:masterfrom
gentnerlab:master
Open

Merging updates from gentnerlab into our master branch.#2
Lathomas42 wants to merge 132 commits into
theunissenlab:masterfrom
gentnerlab:master

Conversation

@Lathomas42

Copy link
Copy Markdown

Going to create this pull request to see the merge conflicts

neuromusic and others added 30 commits July 14, 2015 14:28
adding support for Arduino
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
xingjeffrey and others added 30 commits February 16, 2024 11:48
- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants