fossasia / pslab-python

Python Library for PSLab Desktop: https://pslab.io
GNU General Public License v3.0
1.62k stars 226 forks source link

made initial split for power_supply module #153

Closed vaibhavarora102 closed 3 years ago

vaibhavarora102 commented 3 years ago

In respect to issue #127 Had split the sciencelab class into the subcategory of power_suppply Till now had added made change in sciencelab.py and had made power_supply.py

vaibhavarora102 commented 3 years ago

@bessman
I didn't get this point Individual instruments should not have their own connect methods.

rest had tried to do kindly check

bessman commented 3 years ago

The serial communication should be handled by a PSL.packet_handler.Handler instance. The PowerSupply class should accept such an instance as an optional initialization argument. If no Handler object is provided, PowerSupply should create a new instance and use that for communication.

Take a look at for example the Oscilloscope for an example of how this works in other modules.

Also, please have a look at the Travis and Codacy errors and fix them.

vaibhavarora102 commented 3 years ago

Hi @bessman in Oscilloscope, I guess you were stating to self._device to use for set, get and other communications but in power supply, we are using self.DAC from MCP4728, so should I use self._device and further proceed directly using MCP4728 in place of self.DAC or something else, can you please help?

can you please give a bit of insight that what exactly travis and codeacy errors are for thanks

bessman commented 3 years ago

In order for the PowerSupply to be able to talk to the PSLab and tell it what to do, it requires a serial interface. The Handler provides this interface. In the PowerSupply's case, the low level communication happens in the MCP4728 class, which takes a Handler instance as its first argument. The PowerSupply should accept a Handler instance (or create a new one), and hand it to the MCP4728.

Codacy is just complaining about a trailing white space on L432. Simply remove it to make Codacy happy.

Travis fails because the connect method is on the wrong indentation level. As discussed above, you should remove the connect method completely rather than fix it. You also have another indentation error on L36.

vaibhavarora102 commented 3 years ago

Hi @bessman Thanks for your patience and guidance

But I would not be able to continue due to university exams So, kindly assign

Thanks

bessman commented 3 years ago

Thanks for giving this a try. I'm closing this now, as it is superseded by #158.