Conversation
- Migrate RPPorts interface to Pi 5 compatible implementation using RPi.GPIO (lgpio backend) - Add Pi 5 compatible display initialization with auto-detection and frame buffer support in calibration and welcome screens - Improve pygame display handling with fullscreen support, proper scaling, and FPS control
scales the numpad button padding, which the branch had left at fixed 800x480 values while scaling the rectangles drawn behind them.
unpacks width and height in the right order, and skips the assignment when the framebuffer read fails. Previously a failed read returned None and the unpack raised TypeError, which the surrounding except pygame.error would not have caught.
The ready timer was restarted on every proximity edge while the animal stayed in position, so the dwell time it measured was reset by switch bounce. It now starts only on a real entry, when the stored position was previously empty. The same fix is applied to both interfaces so their behaviour stays identical.
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.
Description
Adds Raspberry Pi 5 support to EthoPy and fixes the display and proximity problems that surfaced while running experiments in the Pi 5.
The Pi 5 dropped the memory-mapped GPIO access that
pigpioand the classicRPi.GPIOrely on, so the existingRPPortsinterface cannot drive a Pi 5 rig at all. This branch adds a parallelRPPorts5interface built onrpi-lgpioandlgpio, leavingRPPortsuntouched for the Pi 4 setups already in the lab.New Pi 5 interface (
src/ethopy/interfaces/RPPorts5.py)RPPorts5, a fullInterfaceimplementation onrpi-lgpio, covering lick detection, proximity, liquid reward, odor, opto stimulation, and sync in/out.lgpio.tx_pulse, so the pulse width is timed in hardware rather than by a sleeping Python thread.RPi.GPIO.PWMin place ofpigpiowave generation, with athreading.Eventto stop continuous and pulsed tones cleanly.ImportErrornamingrpi-lgpiowhen the package is missing, instead of failing later at first GPIO call.Proximity timer fix (
RPPorts.py,RPPorts5.py)The ready timer was restarted on every proximity edge while the animal stayed in position, so the dwell time it measured was reset. It now starts only on a real entry, when the stored position was previously empty. The same fix is applied to both interfaces so their behaviour stays identical.
Display setup (
start.py,calibrate.py)Both pygame screens hardcoded a resolution and requested it explicitly with the fullscreen flag. On a Pi 5 a requested size that differs from the actual desktop mode returns a surface that segfaults on reports its dimensions in the opposite order on some units. Both now ask SDL for the desktop resolution with
set_mode((0, 0), FULLSCREEN)and read the real dimensions back from the surface, then scale every font size and widget position from those. This makes the welcome screen and the calibration screen usable on any panel rather than only on 800x480.