Skip to content

Commit 2e6c264

Browse files
committed
further changes based on Codacy recommendations
1 parent 97d4fa8 commit 2e6c264

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

PSL/Peripherals.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ def __captureStart__(self,address,location,sample_length,total_samples,tg):
427427
def __retrievebuffer__(self):
428428
'''
429429
Fetch data acquired by the I2C scope. refer to :func:`__captureStart__`
430-
431430
'''
432431
total_int_samples = self.total_bytes/2
433432
DATA_SPLITTING = 500
@@ -457,7 +456,7 @@ def __retrievebuffer__(self):
457456
self.H.__sendInt__(total_int_samples%DATA_SPLITTING)
458457
self.H.__sendInt__(total_int_samples-total_int_samples%DATA_SPLITTING)
459458
rem = 2*(total_int_samples%DATA_SPLITTING)+1
460-
for a in range(20):
459+
for _ in range(20):
461460
partial = self.H.fd.read(rem) #reading int by int sometimes causes a communication error. this works better.
462461
rem -=len(partial)
463462
data+=partial

PSL/SENSORS/Sx1276.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#Registers adapted from sample code for SEMTECH SX1276
22
import time
33

4-
def connect(SPI):
5-
return SX1276(SPI)
4+
def connect(SPI,frq,**kwargs):
5+
return SX1276(SPI,frq,**kwargs)
66

77

88
class SX1276():
@@ -56,7 +56,6 @@ class SX1276():
5656

5757
PA_OUTPUT_RFO_PIN =0
5858
PA_OUTPUT_PA_BOOST_PIN =1
59-
6059
_onReceive = 0
6160
_frequency = 10
6261
_packetIndex = 0
@@ -196,10 +195,10 @@ def reset(self):
196195

197196

198197
def idle(self):
199-
self.SPIWrite(self.REG_OP_MODE,[self.MODE_LONG_RANGE_MODE|self.MODE_STDBY])
198+
self.SPIWrite(self.REG_OP_MODE,[self.MODE_LONG_RANGE_MODE|self.MODE_STDBY])
200199

201200
def sleep(self):
202-
self.SPIWrite(self.REG_OP_MODE,[self.MODE_LONG_RANGE_MODE|self.MODE_SLEEP])
201+
self.SPIWrite(self.REG_OP_MODE,[self.MODE_LONG_RANGE_MODE|self.MODE_SLEEP])
203202

204203
def setTxPower(self,level,pin):
205204
if pin == self.PA_OUTPUT_RFO_PIN:
@@ -308,11 +307,10 @@ def getRaw(self):
308307

309308
if __name__ == "__main__":
310309
RX = 0; TX=1
311-
import time
312310
mode = RX
313311
from PSL import sciencelab
314312
I= sciencelab.connect()
315-
lora = SX1276(I.SPI,434e6,boost=True,power=17,BW=125e3,SF=12,CR=5) #settings for maximum range
313+
lora = SX1276(I.SPI,434e6,boost=True,power=17,BW=125e3,SF=12,CR=5) #settings for maximum range
316314
lora.crc()
317315
cntr=0
318316
while 1:

0 commit comments

Comments
 (0)
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