-
Notifications
You must be signed in to change notification settings - Fork 70
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
CC #416
base: webpack-build
Are you sure you want to change the base?
CC #416
Conversation
…ripherals. Added full peripheral manager communications API (untested beyond checking to see if connection can be established or not)
@zyrrron can you please do a review of this PR, I'd like feedback on naming convention, documentation, etc. |
console.log("Connecting to server..."); | ||
this.socket = io("http://localhost:3000"); | ||
|
||
this.socket.on("connect", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does the "()" work for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This how you define lambda expressions in typescript. It allows you to do inline functions that have access to the local scope.
* @param valveid id | ||
* @param avalve object | ||
*/ | ||
attachAnalogValve(valveid: string, avalve: AnalogValve) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the difference between analogvalve and digitalvalve
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it depends on where you use syringe pumps or pressure control manifold to control the valves.
Analog Valve - Syringe pump - you need to specify OPEN and CLOSE values as integers.
Digital Valve - pressure manifold (what Sam is using) Boolean values.
* @param {Array<number>} args | ||
* @memberof Setup | ||
*/ | ||
sendCommand(deviceName: string, commandID: number, args: Array<number>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this function send commands to hardware? and what is the difference with sendRaw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on what firmware is on the microcontroller, sendCommand might not work. sendCommand
uses an efficient binary format. Whereas sendRaw
will send whatever data the user wants to send. You will need to use sendRaw
to make it work with Sam's existing arduino code.
* @returns {Promise<string[]>} | ||
* @memberof Setup | ||
*/ | ||
async listDevices(): Promise<string[]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the return value is a list of microfluidic devices?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This returns a list of devices (arduino's, microcontrollers, etc.) connect to the computer by USB.
console.log(id); | ||
this.id = id; | ||
this._deviceindex = deviceIndex; | ||
this._hwshield = hwShield; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's hwShield?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was an parameter necessary for the Neptune legacy hardware to function, we can modify it to be some sort of physical location address in the future
this.id = id; | ||
this._deviceindex = deviceIndex; | ||
this._hwshield = hwShield; | ||
this._precision = precision; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
precision?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, this was necessary when generating the corresponding commands for the legacy neptune hardware. We should refactor this
|
||
/** | ||
* Returns the number valves on the device | ||
* @returns {number} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can we get the number of valves if we return this._valves? this._valves is an array of components. if we want to get the number of valves, we should return this._valves.length?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch will look at fixing this
TODO -
- Fix return type for the valves function
} | ||
|
||
/** | ||
* Returns some kind of an object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to return [{}, {}, {}] here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no clue, this is a bug
@@ -0,0 +1,18 @@ | |||
const THETA_MAX = Math.PI / 2; | |||
const THETA_MIN = -THETA_MAX; | |||
export const PWM_MAX = 255; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this file work for? What is PWM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PWM is pulse width modulation, its you convert an analog signal into a digital signal
Created the initial version of class that are used to model the hardware devices connected to the computer. This PR creates the base classes and the potential API class we need to create to manage this. This PR still requires the integration of websockets communication a manager that can query peripheral manager effectively.