Move .py library in lib-src + lint

This commit is contained in:
Pierrick C 2020-04-04 15:28:49 +02:00
parent 1774f764b7
commit 97a81aec58
7 changed files with 10 additions and 52 deletions

View File

@ -54,7 +54,6 @@ from machine import Pin
from micropython import const
#import adafruit_bus_spi.spi_spi as spi_spi
__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MAX31865.git"
@ -92,10 +91,8 @@ _RTD_B = -5.775e-7
class MAX31865:
"""Driver for the MAX31865 thermocouple amplifier."""
def __init__(
self, spi, cs, *, rtd_nominal=100, ref_resistor=430.0,
wires=2, filter_frequency=60
):
def __init__(self, spi, cs, *, rtd_nominal=100, ref_resistor=430.0,
wires=2, filter_frequency=60.0):
self.rtd_nominal = rtd_nominal
self.ref_resistor = ref_resistor
self._spi = spi
@ -157,7 +154,7 @@ class MAX31865:
@property
def bias(self):
"""The state of the sensor's bias (True/False)."""
"""State of the sensor's bias (True/False)."""
return bool(self._read_u8(_MAX31865_CONFIG_REG) & _MAX31865_CONFIG_BIAS)
@bias.setter
@ -171,7 +168,7 @@ class MAX31865:
@property
def auto_convert(self):
"""The state of the sensor's automatic conversion
"""State of the sensor's automatic conversion
mode (True/False).
"""
return bool(self._read_u8(_MAX31865_CONFIG_REG) & _MAX31865_CONFIG_MODEAUTO)

View File

@ -1,13 +1,14 @@
import utime
import time
from . import simple
class MQTTClient(simple.MQTTClient):
DELAY = 2
DEBUG = False
def delay(self, i):
utime.sleep(self.DELAY)
time.sleep(self.DELAY)
def log(self, in_reconnect, e):
if self.DEBUG:

Binary file not shown.

View File

@ -1,40 +0,0 @@
"""Divers fonctions utiles
"""
import time
import machine
import network
from umqtt.robust import MQTTClient
def WifiConnect(ssid, psk):
"""Connect to the wifi with given credentials"""
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
nets = wlan.scan()
for net in nets:
net_ssid = net[0].decode()
if net_ssid == ssid:
print('Network found!')
wlan.connect(net_ssid, psk)
while not wlan.isconnected():
machine.idle() # save power while waiting
print('WLAN connection succeeded!')
break
if not wlan.isconnected():
print("WLAN not found/not connected")
return wlan
def now(rtc):
"""Return a string representing date/time now"""
return "{0:04d}/{1:02d}/{2:02d}_{4:02d}:{5:02d}:{6:02d}".format(*rtc.datetime())
def MqttPublish(client, topic, message, retain=False, qos=0, sleep=10):
"""MQTT publish helper"""
client.publish("test/{device}/{topic}".format(device=client.client_id, topic=topic),
message,
retain=retain,
qos=qos)
time.sleep_ms(sleep)

Binary file not shown.