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

Allow actuator related code to query sensors #90

Open
szmoore opened this issue Nov 8, 2013 · 0 comments
Open

Allow actuator related code to query sensors #90

szmoore opened this issue Nov 8, 2013 · 0 comments

Comments

@szmoore
Copy link
Owner

szmoore commented Nov 8, 2013

Actuators and Sensors are currently treated independently. The move away from global arrays makes it easier to modularize each device into a separate file. However it makes things slightly confusing if controlling one device depends on readings from another. Eg: PID control of pressure regulator using pressure sensor.

Suggest that if an actuator needs to query a sensor, a function is implemented for that sensor which will return the last read value. Then that function can be made extern and the header file for the sensor included in the relevant actuator files. The "last read value" could be stored as a static variable in the sensor code.

This approach avoids the need to add global variables and keeps the thread related code separate from hardware control.

Of course if actuators don't need to query sensors then there is no point worrying about this any further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant