Skip to content

chore: merge development branch with master branch #118

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

Merged
merged 78 commits into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
f2309c4
Add files via upload
wavicles Nov 1, 2016
36cd10b
Fix #36 added steps to build documentation and modified PSL.SENSORS.r…
viveksb007 Mar 20, 2017
88998c7
Update README.md
wavicles Mar 21, 2017
28d9748
resolved conflicts
viveksb007 Mar 21, 2017
06d3ce1
Merge pull request #38 from viveksb007/development
mariobehling Mar 21, 2017
f4860b2
Fix #39 removed some existing bugs and reformatted code acc to pep8 s…
viveksb007 Mar 25, 2017
c1ed400
Fixes #42 Deleted not required files
viveksb007 Apr 9, 2017
2f1f36e
updated readme
viveksb007 Apr 9, 2017
3f018a5
Fixes #42 deleted not required files and updated readme (#44)
viveksb007 Apr 10, 2017
0a017ca
Add support for ADS1115 16-bit ADC
jithinbp Apr 14, 2017
cecbc87
Add support for ADS1115 16-bit ADC (#46)
jithinbp Apr 14, 2017
764532f
Updated TSL2561.py
akarshan96 Apr 15, 2017
e86be68
added reference for values and fixed some warnings
viveksb007 Apr 18, 2017
ee92d0d
modified connectToPort to prevent crash in Windows and OSX
viveksb007 Apr 18, 2017
83710f4
Merge pull request #47 from akarshan96/branch-1
mariobehling Apr 18, 2017
2cddcf2
Merge pull request #51 from viveksb007/development
mariobehling Apr 18, 2017
acf4720
Merge branch 'development' of https://github.com/fossasia/pslab-pytho…
jithinbp Apr 30, 2017
8f12c9e
modify Params dict in MPU6050.py as an example for improving sensor M…
jithinbp Apr 30, 2017
69da398
MPU6050.py : remove powerUp function's argument
jithinbp Apr 30, 2017
9b0f57b
MPU6050.py : Kalman Filtering's options defined in a dictionary element
jithinbp Apr 30, 2017
3e799a1
Modified Params dictionary in all Sensor files
jithinbp Apr 30, 2017
f05e3c8
Convert I2C sensor oscilloscope into non-blocking method
jithinbp May 6, 2017
d0dec8f
add support library for MPU925x 10-DOF IMU sensor
jithinbp May 6, 2017
c8dde2d
Convert I2C sensor oscilloscope into non-blocking method
jithinbp May 6, 2017
acf6c6a
add support library for MPU925x 10-DOF IMU sensor
jithinbp May 6, 2017
2c41fe7
Merge branch 'development' of https://github.com/jithinbp/pslab-pytho…
jithinbp May 7, 2017
d2ec0d6
Update README.md
mariobehling May 8, 2017
fcf6a0d
Improved auto-generated menus in graphical apps. Modified MPU6050.py.…
jithinbp May 8, 2017
7df2c3f
added support for SX1276 LoRa module
jithinbp Jun 3, 2017
ad2f4eb
tested LoRa modules up to 500metres
jithinbp Jun 5, 2017
fff2fa2
Added a transaction function to sciencelab.SPI . made code edits base…
jithinbp Jun 8, 2017
97d4fa8
resolve merge conflicts
jithinbp Jun 8, 2017
2e6c264
further changes based on Codacy recommendations
jithinbp Jun 8, 2017
fcf6357
Merge pull request #63 from jithinbp/development
jithinbp Jun 8, 2017
d871361
remove deprecated function sciencelab.setOnboardLed
jithinbp Jun 8, 2017
8e66c74
Merge branch 'development' of https://github.com/fossasia/pslab-pytho…
jithinbp Jun 8, 2017
4c7fedd
Merge pull request #65 from jithinbp/development
jithinbp Jun 9, 2017
44d5619
rewrite sciencelab.I2C.capture
jithinbp Jun 10, 2017
3ffc54e
Merge pull request #67 from jithinbp/development
jithinbp Jun 10, 2017
f30396a
fixed undefined references in SENSORS/MF522.py . fixes #54
jithinbp Jun 12, 2017
760563b
Merge pull request #68 from jithinbp/development
jithinbp Jun 12, 2017
c2f331b
removed explicit reference to Python3 in Makefile
jithinbp Jun 12, 2017
6672626
Merge pull request #69 from jithinbp/development
jithinbp Jun 12, 2017
2db8949
bug fix in setup.py . undefined reference to "root"
jithinbp Jun 12, 2017
3214ac4
bug fix in setup.py . undefined reference to "root" (#70)
jithinbp Jun 13, 2017
bddac55
bug fix in setup.py . undefined reference to "root"
jithinbp Jun 13, 2017
8bc85f9
merge conflicts
jithinbp Jun 13, 2017
4a8eade
Merge pull request #71 from jithinbp/development
jithinbp Jun 16, 2017
483ed32
Fixes #74: Device support for old and new PSLabs
CloudyPadmal Mar 15, 2018
aa3e6e2
Merge pull request #75 from CloudyPadmal/development
CloudyPadmal Apr 9, 2018
854a8a3
docs: updated links (#77)
CloudyPadmal Oct 14, 2018
158c4bf
Create README.md (#81)
IgorWilbert Oct 21, 2018
bcb2c45
Travis CI: Remove EOLed versions of Python
Oct 25, 2018
dc1c796
Use print() function in both Python 2 and Python 3 (#82)
Nov 11, 2018
78ac311
Merge pull request #84 from cclauss/patch-2
cweitat Dec 29, 2018
80c0dfd
Fix broken initialization on Python 3 (#85)
cynddl Dec 30, 2018
657eda5
Update README.md
mariobehling Jan 31, 2019
fc0ae94
fix: python3 compatible
CloudyPadmal Mar 11, 2019
83aca5c
Merge pull request #86 from CloudyPadmal/python3Compatible
cweitat Mar 12, 2019
24c57a0
Add documentation to Fix permission for make file #88 (#89)
fragm3 Apr 17, 2019
4dab77e
feat: compatibility with Windows (#92)
CloudyPadmal May 8, 2019
1c554a9
Document the PSL Python Library #78 (#90)
fragm3 May 11, 2019
9dcb863
Reformat code and Upgraded Travis + Makefile (#95)
CloudyPadmal May 13, 2019
9f1fea6
Update README.md
mariobehling May 13, 2019
93e0a8c
feat: upgrade makefile to cleanup old libs (#96)
CloudyPadmal May 14, 2019
2744a67
chore: updated makefile with fullcleanup task (#98)
CloudyPadmal May 14, 2019
dd1f8d9
convert byte to int for python3+ (#103)
Pipe-Runner Jul 9, 2019
29db0e1
type casting bytes to int from float
Pipe-Runner Jul 10, 2019
d1e2321
[#105] byte type cast (#106)
Pipe-Runner Jul 28, 2019
d362413
bug in I2C readBulk function fixed (#108)
neel1998 Aug 5, 2019
d0e5af7
Update README.md
mariobehling Aug 26, 2019
164fce6
Update README.md
mariobehling Aug 26, 2019
f123847
Update README.md
mariobehling Aug 27, 2019
7b8eb57
type-error-resolved (#109)
bhadreshpsavani Nov 2, 2019
767a04a
added t and v (#113)
bhadreshpsavani Nov 5, 2019
f68fc60
Add Sensor Names (#111)
bhadreshpsavani Nov 5, 2019
a74d48f
Travis CI add Python 3.7, 3.8 find undefined names (#112)
cclauss Nov 8, 2019
5c03e23
Handle conflict in namespace 'serial' (#114)
bessman Jun 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added reference for values and fixed some warnings
  • Loading branch information
viveksb007 committed Apr 18, 2017
commit e86be68b5ef74e1db95290a6dd565595c8f82a02
42 changes: 26 additions & 16 deletions PSL/Peripherals.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,29 +276,32 @@ def read_repeat(self):
self.H.__sendByte__(CP.I2C_READ_MORE)
val = self.H.__getByte__()
self.H.__get_ack__()
return val
except Exception as ex:
self.raiseException(ex, "Communication Error , Function : " + inspect.currentframe().f_code.co_name)
return val


def read_end(self):
try:
self.H.__sendByte__(CP.I2C_HEADER)
self.H.__sendByte__(CP.I2C_READ_END)
val = self.H.__getByte__()
self.H.__get_ack__()
return val
except Exception as ex:
self.raiseException(ex, "Communication Error , Function : " + inspect.currentframe().f_code.co_name)
return val


def read_status(self):
try:
self.H.__sendByte__(CP.I2C_HEADER)
self.H.__sendByte__(CP.I2C_STATUS)
val = self.H.__getInt__()
self.H.__get_ack__()
return val
except Exception as ex:
self.raiseException(ex, "Communication Error , Function : " + inspect.currentframe().f_code.co_name)
return val


def readBulk(self, device_address, register_address, bytes_to_read):
try:
Expand Down Expand Up @@ -626,9 +629,10 @@ def send8(self, value):
self.H.__sendByte__(value) # value byte
v = self.H.__getByte__()
self.H.__get_ack__()
return v
except Exception as ex:
self.raiseException(ex, "Communication Error , Function : " + inspect.currentframe().f_code.co_name)
return v


def send16(self, value):
"""
Expand All @@ -651,9 +655,10 @@ def send16(self, value):
self.H.__sendInt__(value) # value byte
v = self.H.__getInt__()
self.H.__get_ack__()
return v
except Exception as ex:
self.raiseException(ex, "Communication Error , Function : " + inspect.currentframe().f_code.co_name)
return v


def send8_burst(self, value):
"""
Expand Down Expand Up @@ -762,6 +767,7 @@ def __init__(self, H, vref=3.3, devid=0):
self.CHANS = {'PCS': DACCHAN('PCS', [0, 3.3e-3], 0), 'PV3': DACCHAN('PV3', [0, 3.3], 1),
'PV2': DACCHAN('PV2', [-3.3, 3.3], 2), 'PV1': DACCHAN('PV1', [-5., 5.], 3)}
self.CHANNEL_MAP = {0: 'PCS', 1: 'PV3', 2: 'PV2', 3: 'PV1'}
self.values = {'PV1': 0, 'PV2': 0, 'PV3': 0, 'PCS': 0}

def __ignoreCalibration__(self, name):
self.CHANS[name].calibration_enabled = False
Expand Down Expand Up @@ -798,7 +804,8 @@ def __setRawVoltage__(self, name, v):
'''
val = self.CHANS[name].apply_calibration(v)
self.I2C.writeBulk(self.addr, [64 | (CHAN.channum << 1), (val >> 8) & 0x0F, val & 0xFF])
return CHAN.CodeToV(v)
self.values[name] = CHAN.CodeToV(v)
return self.values[name]

def __writeall__(self, v1, v2, v3, v4):
self.I2C.start(self.addr, 0)
Expand Down Expand Up @@ -871,7 +878,7 @@ class NRF24L01():
I2C_COMMANDS = 2
I2C_TRANSACTION = 0 << 4
I2C_WRITE = 1 << 4
SCAN_I2C = 2 << 4
I2C_SCAN = 2 << 4
PULL_SCL_LOW = 3 << 4
I2C_CONFIG = 4 << 4
I2C_READ = 5 << 4
Expand Down Expand Up @@ -964,9 +971,10 @@ def rxchar(self):
self.H.__sendByte__(CP.NRF_RXCHAR)
value = self.H.__getByte__()
self.H.__get_ack__()
return value
except Exception as ex:
self.raiseException(ex, "Communication Error , Function : " + inspect.currentframe().f_code.co_name)
return value


def txchar(self, char):
'''
Expand All @@ -989,9 +997,10 @@ def hasData(self):
self.H.__sendByte__(CP.NRF_HASDATA)
value = self.H.__getByte__()
self.H.__get_ack__()
return value
except Exception as ex:
self.raiseException(ex, "Communication Error , Function : " + inspect.currentframe().f_code.co_name)
return value


def flush(self):
'''
Expand Down Expand Up @@ -1031,9 +1040,10 @@ def read_register(self, address):
self.H.__sendByte__(address)
val = self.H.__getByte__()
self.H.__get_ack__()
return val
except Exception as ex:
self.raiseException(ex, "Communication Error , Function : " + inspect.currentframe().f_code.co_name)
return val


def get_status(self):
'''
Expand Down Expand Up @@ -1070,9 +1080,9 @@ def write_address(self, register, address):
self.H.__sendByte__(CP.NRFL01)
self.H.__sendByte__(CP.NRF_WRITEADDRESS)
self.H.__sendByte__(register)
self.H.__sendByte__(address & 0xFF);
self.H.__sendByte__((address >> 8) & 0xFF);
self.H.__sendByte__((address >> 16) & 0xFF);
self.H.__sendByte__(address & 0xFF)
self.H.__sendByte__((address >> 8) & 0xFF)
self.H.__sendByte__((address >> 16) & 0xFF)
self.H.__get_ack__()
except Exception as ex:
self.raiseException(ex, "Communication Error , Function : " + inspect.currentframe().f_code.co_name)
Expand All @@ -1085,9 +1095,9 @@ def selectAddress(self, address):
try:
self.H.__sendByte__(CP.NRFL01)
self.H.__sendByte__(CP.NRF_WRITEADDRESSES)
self.H.__sendByte__(address & 0xFF);
self.H.__sendByte__((address >> 8) & 0xFF);
self.H.__sendByte__((address >> 16) & 0xFF);
self.H.__sendByte__(address & 0xFF)
self.H.__sendByte__((address >> 8) & 0xFF)
self.H.__sendByte__((address >> 16) & 0xFF)
self.H.__get_ack__()
self.CURRENT_ADDRESS = address
if address not in self.sigs:
Expand Down
18 changes: 10 additions & 8 deletions PSL/packet_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def listPorts(self):
return glob.glob('/dev/ttyACM*') + glob.glob('/dev/ttyUSB*')

def connectToPort(self, portname):
import socket
try:
import socket
self.blockingSocket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.blockingSocket.bind('\0PSghhhLab%s' % portname)
self.blockingSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
Expand All @@ -72,7 +72,7 @@ def connectToPort(self, portname):
raise RuntimeError("Another program is using %s (%d)" % (portname))

fd = serial.Serial(portname, 9600, stopbits=1, timeout=0.02)
fd.read(100);
fd.read(100)
fd.close()
fd = serial.Serial(portname, self.BAUD, stopbits=1, timeout=1.0)
if (fd.inWaiting()):
Expand Down Expand Up @@ -172,9 +172,10 @@ def __getByte__(self):
reads a byte from the serial port and returns it
"""
ss = self.fd.read(1)
if len(ss):
return CP.Byte.unpack(ss)[0]
else:
try:
if len(ss):
return CP.Byte.unpack(ss)[0]
except Exception as ex:
print('byte communication error.', time.ctime())
self.raiseException(ex, "Communication Error , Function : " + inspect.currentframe().f_code.co_name)
# sys.exit(1)
Expand All @@ -185,9 +186,10 @@ def __getInt__(self):
returns an integer after combining them
"""
ss = self.fd.read(2)
if len(ss) == 2:
return CP.ShortInt.unpack(ss)[0]
else:
try:
if len(ss) == 2:
return CP.ShortInt.unpack(ss)[0]
except Exception as ex:
print('int communication error.', time.ctime())
self.raiseException(ex, "Communication Error , Function : " + inspect.currentframe().f_code.co_name)
# sys.exit(1)
Expand Down
35 changes: 17 additions & 18 deletions PSL/sciencelab.py
Original file line number Diff line number Diff line change
Expand Up @@ -1938,7 +1938,7 @@ def start_one_channel_LA_backup__(self, trigger=1, channel='ID1', maximum_time=6

"""
try:
self.clear_buffer(0, self.MAX_SAMPLES / 2);
self.clear_buffer(0, self.MAX_SAMPLES / 2)
self.H.__sendByte__(CP.TIMING)
self.H.__sendByte__(CP.START_ONE_CHAN_LA)
self.H.__sendInt__(self.MAX_SAMPLES / 4)
Expand Down Expand Up @@ -2085,7 +2085,7 @@ def start_one_channel_LA(self, **args):
# trigger_mode same as channel_mode.
# default_value : 3
try:
self.clear_buffer(0, self.MAX_SAMPLES / 2);
self.clear_buffer(0, self.MAX_SAMPLES / 2)
self.H.__sendByte__(CP.TIMING)
self.H.__sendByte__(CP.START_ALTERNATE_ONE_CHAN_LA)
self.H.__sendInt__(self.MAX_SAMPLES / 4)
Expand Down Expand Up @@ -2167,7 +2167,7 @@ def start_two_channel_LA(self, **args):
trigger = 0

try:
self.clear_buffer(0, self.MAX_SAMPLES);
self.clear_buffer(0, self.MAX_SAMPLES)
self.H.__sendByte__(CP.TIMING)
self.H.__sendByte__(CP.START_TWO_CHAN_LA)
self.H.__sendInt__(self.MAX_SAMPLES / 4)
Expand All @@ -2176,13 +2176,13 @@ def start_two_channel_LA(self, **args):
self.H.__sendByte__((modes[1] << 4) | modes[0]) # Modes. four bits each
self.H.__sendByte__((chans[1] << 4) | chans[0]) # Channels. four bits each
self.H.__get_ack__()
n = 0;
n = 0
for a in self.dchans[:2]:
a.prescaler = 0;
a.length = self.MAX_SAMPLES / 4;
a.datatype = 'long';
a.prescaler = 0
a.length = self.MAX_SAMPLES / 4
a.datatype = 'long'
a.maximum_time = maximum_time * 1e6 # conversion to uS
a.mode = modes[n];
a.mode = modes[n]
a.channel_number = chans[n]
a.name = strchans[n]
n += 1
Expand Down Expand Up @@ -2221,7 +2221,7 @@ def start_three_channel_LA(self, **args):

"""
try:
self.clear_buffer(0, self.MAX_SAMPLES);
self.clear_buffer(0, self.MAX_SAMPLES)
self.H.__sendByte__(CP.TIMING)
self.H.__sendByte__(CP.START_THREE_CHAN_LA)
self.H.__sendInt__(self.MAX_SAMPLES / 4)
Expand Down Expand Up @@ -2289,7 +2289,7 @@ def start_four_channel_LA(self, trigger=1, maximum_time=0.001, mode=[1, 1, 1, 1]
Use :func:`fetch_long_data_from_LA` (points to read,x) to get data acquired from channel x.
The read data can be accessed from :class:`~ScienceLab.dchans` [x-1]
"""
self.clear_buffer(0, self.MAX_SAMPLES);
self.clear_buffer(0, self.MAX_SAMPLES)
prescale = 0
"""
if(maximum_time > 0.26):
Expand Down Expand Up @@ -2403,7 +2403,7 @@ def fetch_int_data_from_LA(self, bytes, chan=1):
self.raiseException(ex, "Communication Error , Function : " + inspect.currentframe().f_code.co_name)

t = np.trim_zeros(t)
b = 1;
b = 1
rollovers = 0
while b < len(t):
if (t[b] < t[b - 1] and t[b] != 0):
Expand Down Expand Up @@ -3277,7 +3277,7 @@ def load_equation(self, chan, function, span=None, **kwargs):

'''
if function == 'sine' or function == np.sin:
function = np.sin;
function = np.sin
span = [0, 2 * np.pi]
self.WType[chan] = 'sine'
elif function == 'tria':
Expand Down Expand Up @@ -3759,11 +3759,11 @@ def WS2812B(self, cols, output='CS1'):
self.H.__sendByte__(len(cols) * 3)
for col in cols:
# R=reverse_bits(int(col[0]));G=reverse_bits(int(col[1]));B=reverse_bits(int(col[2]))
R = col[0];
G = col[1];
B = col[2];
self.H.__sendByte__(G);
self.H.__sendByte__(R);
R = col[0]
G = col[1]
B = col[2]
self.H.__sendByte__(G)
self.H.__sendByte__(R)
self.H.__sendByte__(B)
# print(col)
self.H.__get_ack__()
Expand Down Expand Up @@ -3892,7 +3892,6 @@ def __stepperMotor__(self, steps, delay, direction):
except Exception as ex:
self.raiseException(ex, "Communication Error , Function : " + inspect.currentframe().f_code.co_name)

t = time.time()
time.sleep(steps * delay * 1e-3) # convert mS to S

def stepForward(self, steps, delay):
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy