René's URL Explorer Experiment


Title: Access Rsync event · pyControl · Discussion #162 · GitHub

Open Graph Title: Access Rsync event · pyControl · Discussion #162

X Title: Access Rsync event · pyControl · Discussion #162

Description: Access Rsync event

Open Graph Description: Hello, This may be fairly trivial and hopefully possible. I'm trying to listen to when a rsync event occurs while a task is being run, have a conditional catch it, and in my case have an LED turn o...

X Description: Hello, This may be fairly trivial and hopefully possible. I'm trying to listen to when a rsync event occurs while a task is being run, have a conditional catch it, and in my case have an LED tu...

Opengraph URL: https://github.com/orgs/pyControl/discussions/162

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"Access Rsync event","text":"

Hello,

\n

This may be fairly trivial and hopefully possible. I'm trying to listen to when a rsync event occurs while a task is being run, have a conditional catch it, and in my case have an LED turn on every time a pulse goes out.

\n

The issue is that when I do have a conditional listening to rsync events (which are successfully going out and logging), nothing occurs. I'm assuming I'm referencing it wrong.

\n

Below is a short example.

\n
  from pyControl.utility import *\n  from devices import *\n  import hardware_definition as hw\n\n  sync_output = Rsync(pin=board.BNC_1, event_name='rsync', mean_IPI=1000)\n\n  states = [\"trial\"]\n\n  events = [\"session_timer\", \"rsync\"]\n\n  initial_state = \"trial\"\n\n\n  def trial(event):\n\n      if event == \"rsync\":\n          #--------> Do something <--------------\n
","upvoteCount":1,"answerCount":3,"acceptedAnswer":{"@type":"Answer","text":"

The rsync event does not get processed by the state machine, it just goes straight to the data log. The line of interest is

\n
\n

\n code/source/pyControl/hardware.py\n

\n

\n Line 509\n in\n e6fe329\n

\n
\n
\n \n\n \n \n \n \n
fw.data_output_queue.put(fw.Datatuple(fw.current_time, fw.EVENT_TYP, \"s\", self.event_ID))
\n
\n
\n

\n

I believe this is intentional so the sync signal is as low overhead as possible? @ThomasAkam, should we add an option to the Rsync initialization for sending the event to the event queue? Something like...

\n
class Rsync(IO_object):\n    # Class for generating sync pulses with random inter-pulse interval.\n\n    def __init__(self, pin, event_name=\"rsync\", mean_IPI=5000, pulse_dur=50, process_event=False):\n        assert 0.1 * mean_IPI > pulse_dur, \"0.1*mean_IPI must be greater than pulse_dur\"\n        self.sync_pin = pyb.Pin(pin, pyb.Pin.OUT)\n        self.event_name = event_name\n        self.pulse_dur = pulse_dur  # Sync pulse duration (ms)\n        self.process_event = process_event\n        self.min_IPI = int(0.1 * mean_IPI)\n        self.max_IPI = int(1.9 * mean_IPI)\n        assign_ID(self)\n\n    def _initialise(self):\n        self.event_ID = sm.events[self.event_name] if self.event_name in sm.events else False\n\n    def _run_start(self):\n        if self.event_ID:\n            self.state = False  # Whether output is high or low.\n            self._timer_callback()\n\n    def _run_stop(self):\n        self.sync_pin.value(False)\n\n    def _timer_callback(self):\n        if self.state:  # Pin high -> low, set timer for next pulse.\n            timer.set(randint(self.min_IPI, self.max_IPI), fw.HARDW_TYP, \"\", self.ID)\n        else:  # Pin low -> high, set timer for pulse duration.\n            timer.set(self.pulse_dur, fw.HARDW_TYP, \"\", self.ID)\n            if self.process_event:\n                fw.event_queue.put(fw.Datatuple(fw.current_time, fw.EVENT_TYP, \"s\", self.event_ID))\n            else:\n                fw.data_output_queue.put(fw.Datatuple(fw.current_time, fw.EVENT_TYP, \"s\", self.event_ID))\n        self.state = not self.state\n        self.sync_pin.value(self.state)
","upvoteCount":1,"url":"https://github.com/orgs/pyControl/discussions/162#discussioncomment-14821569"}}}

route-pattern/_view_fragments/Voltron::DiscussionsFragmentsController/show/orgs/:org/:discussion_number/discussion_layout(.:format)
route-controllervoltron_discussions_fragments
route-actiondiscussion_layout
fetch-noncev2:f123fbf3-8f20-4cbb-46ee-5feaf8ee211d
current-catalog-service-hash9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be
request-idE286:871AF:1A988:24544:698E14A2
html-safe-noncea211558559df1410b5b9e28bad9c6b481f4e76c46bd5620cba0186e4ccfa83f3
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMjg2Ojg3MUFGOjFBOTg4OjI0NTQ0OjY5OEUxNEEyIiwidmlzaXRvcl9pZCI6IjYzMDcyNjgyNzYwNTg0NjEzNDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac8baddb3c40a8e5e215d35c454dabb9d1175b5c90dc8d56912a069e0b0fb6151d
hovercard-subject-tagdiscussion:9086883
github-keyboard-shortcutsrepository,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/discussions_fragments/discussion_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/orgs/pyControl/162/discussion_layout
twitter:imagehttps://opengraph.githubassets.com/dd92ed3739efdaa18ea37470cca4e0bf7cdfe2e7a1edfc5233f7f7ecc84502b2/orgs/pyControl/discussions/162
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/dd92ed3739efdaa18ea37470cca4e0bf7cdfe2e7a1edfc5233f7f7ecc84502b2/orgs/pyControl/discussions/162
og:image:altHello, This may be fairly trivial and hopefully possible. I'm trying to listen to when a rsync event occurs while a task is being run, have a conditional catch it, and in my case have an LED turn o...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonefdf74c91c9ac187cc5cd7b14d4af2d6ef3e18136d002f5d36253f8538e97ee4c
turbo-cache-controlno-preview
octolytics-dimension-user_id58780920
octolytics-dimension-user_loginpyControl
octolytics-dimension-repository_id219033872
octolytics-dimension-repository_nwopyControl/code
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id219033872
octolytics-dimension-repository_network_root_nwopyControl/code
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release1a5a3e7bbfb3486980e340c242368684156fba87
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/pyControl/code/discussions/162#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Forgs%2FpyControl%2Fdiscussions%2F162
pyControlhttps://patch-diff.githubusercontent.com/pyControl
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Forgs%2FpyControl%2Fdiscussions%2F162
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fdiscussions_fragments%2Fdiscussion_layout&source=header-repo&source_repo=pyControl%2Fcode
Reloadhttps://patch-diff.githubusercontent.com/pyControl/code/discussions/162
Reloadhttps://patch-diff.githubusercontent.com/pyControl/code/discussions/162
Reloadhttps://patch-diff.githubusercontent.com/pyControl/code/discussions/162
pyControl https://patch-diff.githubusercontent.com/pyControl
Overview https://patch-diff.githubusercontent.com/pyControl
Repositories https://patch-diff.githubusercontent.com/orgs/pyControl/repositories
Discussions https://patch-diff.githubusercontent.com/orgs/pyControl/discussions
Projects https://patch-diff.githubusercontent.com/orgs/pyControl/projects
Packages https://patch-diff.githubusercontent.com/orgs/pyControl/packages
People https://patch-diff.githubusercontent.com/orgs/pyControl/people
Overviewhttps://patch-diff.githubusercontent.com/pyControl
Repositorieshttps://patch-diff.githubusercontent.com/orgs/pyControl/repositories
Discussionshttps://patch-diff.githubusercontent.com/orgs/pyControl/discussions
Projectshttps://patch-diff.githubusercontent.com/orgs/pyControl/projects
Packageshttps://patch-diff.githubusercontent.com/orgs/pyControl/packages
Peoplehttps://patch-diff.githubusercontent.com/orgs/pyControl/people
Answered https://patch-diff.githubusercontent.com/pyControl/code/discussions/162#discussioncomment-14821569
alustig3https://patch-diff.githubusercontent.com/alustig3
sbtnRey https://patch-diff.githubusercontent.com/sbtnRey
Q&Ahttps://patch-diff.githubusercontent.com/orgs/pyControl/discussions/categories/q-a
Access Rsync event https://patch-diff.githubusercontent.com/pyControl/code/discussions/162#top
sbtnRey https://patch-diff.githubusercontent.com/sbtnRey
Answered https://patch-diff.githubusercontent.com/pyControl/code/discussions/162#discussioncomment-14821569
alustig3https://patch-diff.githubusercontent.com/alustig3
Return to tophttps://patch-diff.githubusercontent.com/pyControl/code/discussions/162#top
Please reload this pagehttps://patch-diff.githubusercontent.com/pyControl/code/discussions/162
https://patch-diff.githubusercontent.com/pyControl/code/discussions/162
sbtnRey https://patch-diff.githubusercontent.com/sbtnRey
Oct 30, 2025 https://patch-diff.githubusercontent.com/pyControl/code/discussions/162#discussion-9086883
Give feedback.https://patch-diff.githubusercontent.com/pyControl/code/discussions/162
alustig3 https://patch-diff.githubusercontent.com/alustig3
Oct 30, 2025 https://github.com/orgs/pyControl/discussions/162#discussioncomment-14821569
code/source/pyControl/hardware.pyhttps://github.com/pyControl/code/blob/e6fe329e5f1ad85766a365e2b89836eb93e39eae/source/pyControl/hardware.py#L509
e6fe329https://patch-diff.githubusercontent.com/pyControl/code/commit/e6fe329e5f1ad85766a365e2b89836eb93e39eae
@ThomasAkamhttps://github.com/ThomasAkam
View full answer https://patch-diff.githubusercontent.com/pyControl/code/discussions/162#discussioncomment-14821569
Oldest https://patch-diff.githubusercontent.com/orgs/pyControl/discussions/162?sort=old
Newest https://patch-diff.githubusercontent.com/orgs/pyControl/discussions/162?sort=new
Top https://patch-diff.githubusercontent.com/orgs/pyControl/discussions/162?sort=top
Please reload this pagehttps://patch-diff.githubusercontent.com/pyControl/code/discussions/162
https://patch-diff.githubusercontent.com/pyControl/code/discussions/162
alustig3 https://patch-diff.githubusercontent.com/alustig3
Oct 30, 2025 https://patch-diff.githubusercontent.com/pyControl/code/discussions/162#discussioncomment-14821569
code/source/pyControl/hardware.pyhttps://github.com/pyControl/code/blob/e6fe329e5f1ad85766a365e2b89836eb93e39eae/source/pyControl/hardware.py#L509
e6fe329https://patch-diff.githubusercontent.com/pyControl/code/commit/e6fe329e5f1ad85766a365e2b89836eb93e39eae
@ThomasAkamhttps://github.com/ThomasAkam
Give feedback.https://patch-diff.githubusercontent.com/pyControl/code/discussions/162
https://patch-diff.githubusercontent.com/sbtnRey
Please reload this pagehttps://patch-diff.githubusercontent.com/pyControl/code/discussions/162
https://patch-diff.githubusercontent.com/pyControl/code/discussions/162
sbtnReyhttps://patch-diff.githubusercontent.com/sbtnRey
Oct 31, 2025 https://patch-diff.githubusercontent.com/pyControl/code/discussions/162#discussioncomment-14832474
Give feedback.https://patch-diff.githubusercontent.com/pyControl/code/discussions/162
https://patch-diff.githubusercontent.com/alustig3
Please reload this pagehttps://patch-diff.githubusercontent.com/pyControl/code/discussions/162
https://patch-diff.githubusercontent.com/pyControl/code/discussions/162
alustig3https://patch-diff.githubusercontent.com/alustig3
Oct 31, 2025 https://patch-diff.githubusercontent.com/pyControl/code/discussions/162#discussioncomment-14832488
Give feedback.https://patch-diff.githubusercontent.com/pyControl/code/discussions/162
sbtnReyhttps://patch-diff.githubusercontent.com/sbtnRey
Please reload this pagehttps://patch-diff.githubusercontent.com/pyControl/code/discussions/162
https://patch-diff.githubusercontent.com/pyControl/code/discussions/162
ThomasAkam https://patch-diff.githubusercontent.com/ThomasAkam
Nov 1, 2025 https://patch-diff.githubusercontent.com/pyControl/code/discussions/162#discussioncomment-14845107
herehttps://github.com/orgs/pyControl/discussions/144
@alustig3https://github.com/alustig3
Give feedback.https://patch-diff.githubusercontent.com/pyControl/code/discussions/162
Please reload this pagehttps://patch-diff.githubusercontent.com/pyControl/code/discussions/162
https://patch-diff.githubusercontent.com/pyControl/code/discussions/162
ThomasAkam https://patch-diff.githubusercontent.com/ThomasAkam
Nov 2, 2025 https://patch-diff.githubusercontent.com/pyControl/code/discussions/162#discussioncomment-14852410
Give feedback.https://patch-diff.githubusercontent.com/pyControl/code/discussions/162
Sign up for freehttps://patch-diff.githubusercontent.com/join?source=comment-repo
Sign in to commenthttps://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Forgs%2FpyControl%2Fdiscussions%2F162
🙏 Q&A https://patch-diff.githubusercontent.com/orgs/pyControl/discussions/categories/q-a
https://patch-diff.githubusercontent.com/sbtnRey
https://patch-diff.githubusercontent.com/ThomasAkam
https://patch-diff.githubusercontent.com/alustig3
https://patch-diff.githubusercontent.com/pyControl/code/discussions/162
https://patch-diff.githubusercontent.com/settings/replies?return_to=1
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.