Skip to content
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

DetectionSensor: more flexible triggering #4780

Merged

Conversation

augustozanellato
Copy link
Contributor

@augustozanellato augustozanellato commented Sep 19, 2024

This PR introduces support for more triggering types in detection sensor, specifically:

  • LOGIC_LOW: same as previous behavior with detection_triggered_high set to false: a "detection message" is sent every minimum_broadcast_secs if pin is low;
  • LOGIC_HIGH: same as previous behavior with detection_triggered_high set to true: a "detection message" is sent every minimum_broadcast_secs if pin is high;
  • FALLING_EDGE: a single "detection message" is sent when pin goes from high to low;
  • RISING_EDGE: a single "detection message" is sent when pin goes from low to high;
  • EITHER_EDGE_ACTIVE_LOW: a single "detection message" is sent when pin goes from high to low, another single "state message" is sent when pin goes from low to high;
  • EITHER_EDGE_ACTIVE_HIGH: a single "detection message" is sent when pin goes from low to high, another single "state message" is sent when pin goes from high to low;

Fixes #4753.

Depends on meshtastic/protobufs#582 to be merged first.

@augustozanellato augustozanellato force-pushed the detsensor_broadcast_changes branch from f5a5855 to 0a52631 Compare September 19, 2024 20:18
@augustozanellato augustozanellato marked this pull request as draft September 19, 2024 21:36
@augustozanellato augustozanellato marked this pull request as draft September 19, 2024 21:36
@augustozanellato augustozanellato marked this pull request as draft September 19, 2024 21:36
@augustozanellato augustozanellato force-pushed the detsensor_broadcast_changes branch from 0a52631 to be01c18 Compare September 23, 2024 14:16
@augustozanellato
Copy link
Contributor Author

Should be ready for some preliminary code review, still needs some testing on my end (ETA: ~24h)

@augustozanellato augustozanellato changed the title DetectionSensor: allow to broadcast all state changes DetectionSensor: more flexible triggering Sep 24, 2024
@augustozanellato augustozanellato marked this pull request as ready for review September 24, 2024 10:02
@thebentern
Copy link
Contributor

@augustozanellato looks great! I added some feedback about using the new Throttle utility method for time windowing. Once those changes are in, I think we're good to merge.

@augustozanellato
Copy link
Contributor Author

Changes addressed!
Btw trunk is failing on a file I haven't touched so probably it's borked on master:

.github/workflows/tests.yml:60:14
  -:-   fmt   Incorrect formatting, autoformat by running 'trunk fmt'                                                                                                                            prettier               
 60:14  high  label "test-runner" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4...              actionlint/runner-label
              .trunk/out/B7X.txt 

@augustozanellato augustozanellato force-pushed the detsensor_broadcast_changes branch from 3b2f488 to ed4527c Compare September 25, 2024 18:03
@augustozanellato
Copy link
Contributor Author

I missed a ), now everything should build fine

@augustozanellato
Copy link
Contributor Author

Failed jobs seem to be caused by ci flakyness (and probably issues on github's end), a restart should fix them

@caveman99 caveman99 merged commit 581686c into meshtastic:master Sep 25, 2024
116 checks passed
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.

[Bug]: Detection sensor documentation inaccuracy
3 participants