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

Have one interface per state machine #184

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

Conversation

jonapap
Copy link
Member

@jonapap jonapap commented Mar 15, 2022

So I've gone ahead and split the interface to be per state machine. In short:

  • No more global interface configured using #if flags. Each state machine has its own interface.
  • This allows a lot of #if to be removed.
  • Add a DESKTOP_COMPAT flag. In the future, the intent is for this to be the only configurable flag (along with HOTFIRE_TEST and other project flags)

More refactoring/changes can still be done. However, those will probably be reserved for other PRs:

  • Have 1 state object per interface/state-machine (e.g. HotFireState instead of StateData)
  • Decide if SensorLogger should output CSV or Protobuf
  • Move conversion from SensorLogger to each state object
  • Remove TestingInterface and add the testing code to Interface.h

This is related to changes discussed here: https://avwiki.uorocketry.ca/en/Avionics/Software/Proposals/Interface-Overhaul. I figured no matter the direction we decide to take (async vs sync), we need one way or another to do this change.

@jonapap jonapap force-pushed the interface-refactor branch from 3ce8922 to 34d9c4c Compare March 15, 2022 22:24
Copy link
Contributor

@seofernando25 seofernando25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a dream <3 Good stuff, thanks!

- #if 
- #endif

What do you think of using cfg/ini files or cli args instead of defines in the future?
That way we could cut down even futher on using #ifdef USE_XXXX and even #define INTERFACE SomeInterface and that would also help to solve #142

@jonapap
Copy link
Member Author

jonapap commented Mar 16, 2022

What a dream <3 Good stuff, thanks!

- #if 
- #endif

What do you think of using cfg/ini files or cli args instead of defines in the future? That way we could cut down even futher on using #ifdef USE_XXXX and even #define INTERFACE SomeInterface and that would also help to solve #142

Maybe? The thing with cfg/ini files is that they are parsed at runtime. Ideally, all those things should be figured out at compile time in some way. This produces a single binary, prevents runtime issues, and allows the compiler to optimize away unneeded stuff. Right now, my main goal is to reduce preprocessor flags to a more manageable level. I believe having a small amount of #defines is fine, as long as there isn't really another way to achieve the same behaviour.

Copy link
Contributor

@seofernando25 seofernando25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run the octoberSky test, it seems the program never halts. That doesn't seem like the expected behaviour. Is it something with the state machine, threads, etc?

asciicast

@jonapap
Copy link
Member Author

jonapap commented Mar 18, 2022

When I run the octoberSky test, it seems the program never halts. That doesn't seem like the expected behaviour. Is it something with the state machine, threads, etc?

asciicast

Are you on the latest commit? I was sure I fixed that issue. Those CI tests now pass fine.

Copy link
Contributor

@seofernando25 seofernando25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's weird 🤔 nevermind then...

@jonapap jonapap marked this pull request as draft May 12, 2022 00:47
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.

2 participants