Fix 3 bugs
This commit is contained in:
parent
ed9a22b1c7
commit
2d63fcc58f
3 changed files with 8 additions and 5 deletions
|
@ -71,10 +71,10 @@ class MetricsLogging():
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def worker():
|
def worker():
|
||||||
while True:
|
point = object()
|
||||||
|
for job in iter(point_queue.get, point):
|
||||||
try:
|
try:
|
||||||
points = point_queue.get_many()
|
write_api.write(BUCKET, ORG, point)
|
||||||
write_api.write(BUCKET, ORG, points)
|
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -170,7 +170,7 @@ class Motor(object):
|
||||||
if speed < min(curve) or speed > max(curve):
|
if speed < min(curve) or speed > max(curve):
|
||||||
raise ValueError(f'Speed out of range: {str(speed)} ticks/s')
|
raise ValueError(f'Speed out of range: {str(speed)} ticks/s')
|
||||||
|
|
||||||
for index in range(len(curve) - 2):
|
for index in range(len(curve) - 1):
|
||||||
if speed >= curve[index] and speed <= curve[index + 1] and curve[index] != curve[index + 1]:
|
if speed >= curve[index] and speed <= curve[index + 1] and curve[index] != curve[index + 1]:
|
||||||
return Motor.__map(speed, curve[index], curve[index + 1], index * 5, index * 5 + 5)
|
return Motor.__map(speed, curve[index], curve[index + 1], index * 5, index * 5 + 5)
|
||||||
|
|
||||||
|
@ -184,7 +184,10 @@ class Motor(object):
|
||||||
if power < 0 or power > 100:
|
if power < 0 or power > 100:
|
||||||
raise ValueError(f'Power out of range: {str(power)}%')
|
raise ValueError(f'Power out of range: {str(power)}%')
|
||||||
|
|
||||||
|
print(power)
|
||||||
requiredSpeed = Motor.__map(power, 0, 100, min(curve), max(curve))
|
requiredSpeed = Motor.__map(power, 0, 100, min(curve), max(curve))
|
||||||
|
print(requiredSpeed)
|
||||||
|
|
||||||
return Motor.__interpolateSpeed(curve, requiredSpeed)
|
return Motor.__interpolateSpeed(curve, requiredSpeed)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ class Spi(object):
|
||||||
def health_check_loop():
|
def health_check_loop():
|
||||||
while SPI_HEALTH:
|
while SPI_HEALTH:
|
||||||
Spi.health_check()
|
Spi.health_check()
|
||||||
time.sleep(5)
|
time.sleep(0.75)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_version():
|
def get_version():
|
||||||
|
|
Reference in a new issue