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

Sending pad_server state over telemetry #47

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

bskdany
Copy link
Contributor

@bskdany bskdany commented Nov 28, 2024

Closes #13

  • Created the telemetry_padstate thread, which sends the pad state and then spends PADSTATE_UPDATE_TIMEOUT_SEC time waiting for a pthread_cond signal to be sent. If the cond signal is received before the target time, it repeats the waiting process until it is over.
  • A shared struct is introduced called padstate_last_update_t, it contains a mutex, a cond and the data that is passed from one thread to the other.
  • The actuator and arming helper functions lock the mutex, write the data to the shared struct and signal the cond
  • On cond receival the telemetry_padstate tread sends over the passed data from the shared struct.
  • A new cleanup function is introduced called telemetry_cancel_padstate_thread which on the telemetry thread cleanup terminates the telemetry_padstate thread.

Tested for correct functionality and deadlocks

@bskdany bskdany changed the title Added state sending every second Sending pad_server state over telemetry Nov 28, 2024
@bskdany bskdany marked this pull request as ready for review November 28, 2024 19:20
@justapotato213
Copy link
Contributor

Bit of a dumb question but how come you're using a second shared struct rather than reusing padstate?

@bskdany
Copy link
Contributor Author

bskdany commented Nov 30, 2024

Bit of a dumb question but how come you're using a second shared struct rather than reusing padstate?

Idk I had to save the last updated state somewhere. Maybe moving it into the padstate_t struct isn't a bad idea

@bskdany
Copy link
Contributor Author

bskdany commented Nov 30, 2024

@EliasJRH done

pad_server/src/state.h Outdated Show resolved Hide resolved
pad_server/src/state.h Outdated Show resolved Hide resolved
pad_server/src/telemetry.c Outdated Show resolved Hide resolved
@bskdany bskdany requested a review from linguini1 December 27, 2024 20:26
pad_server/src/telemetry.c Outdated Show resolved Hide resolved
pad_server/src/telemetry.c Outdated Show resolved Hide resolved
@bskdany bskdany requested a review from linguini1 December 27, 2024 20:49
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.

Arming and actuator state telemetry
3 participants