Skip to content

Commit

Permalink
fixed major calibration bugs
Browse files Browse the repository at this point in the history
refactored serial driver
changed ciclop default config
made non blocking stepper working
  • Loading branch information
Mario Lukas authored and Mario Lukas committed Jul 1, 2019
1 parent 269eab2 commit 05485b1
Show file tree
Hide file tree
Showing 10 changed files with 1,721 additions and 67 deletions.
22 changes: 22 additions & 0 deletions src/fabscan/FSScanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import time
import threading
import logging
import os
import multiprocessing
from apscheduler.schedulers.background import BackgroundScheduler

Expand All @@ -21,6 +22,7 @@
from fabscan.lib.util.FSInject import inject, singleton
from fabscan.lib.util.FSUpdate import upgrade_is_available, do_upgrade
from fabscan.lib.util.FSDiscovery import register_to_discovery
from fabscan.lib.util.FSSystemWatch import get_cpu_temperature

class FSState(object):
IDLE = "IDLE"
Expand Down Expand Up @@ -92,9 +94,12 @@ def __init__(self, settings, config, eventmanager, scanprocessor):
self.scheduler.add_job(self.run_discovery_service, 'interval', minutes=30, id='register_discovery_service')
self._logger.info("Added discovery scheduling job.")

self.scheduler.add_job(self.run_temperature_watch_service, 'interval', minutes=1, id='cpu_temperature_service')

def run(self):
while not self.exit:
self.eventManager.handle_event_q()

time.sleep(0.05)

self.scanProcessor.stop()
Expand Down Expand Up @@ -271,6 +276,23 @@ def set_state(self, state):
def get_state(self):
return self._state


## Scheduled functions see init function!!

def run_temperature_watch_service(self):
cpu_temp = get_cpu_temperature()
if ( cpu_temp > 70):
self._logger.warning('High CPU Temperature: '+ str(cpu_temp) + " C")
message = {
"message": "HIGH CPU Temp: " + str(cpu_temp) + " C!",
"level": "warn"
}

self.eventManager.broadcast_client_message(FSEvents.ON_INFO_MESSAGE, message)
else:
self._logger.debug("CPU Temperature: " + str(cpu_temp) + " C")


def run_discovery_service(self):

try:
Expand Down
8 changes: 4 additions & 4 deletions src/fabscan/config/ciclop.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"weight_matrix": [],
"dist_camera_matrix": [],
"pattern": {
"square_size": 11,
"square_size": 8,
"rows": 6,
"columns": 8,
"origin_distance": 37.2
"columns": 10,
"origin_distance": 35
},
"camera_matrix": [],
"distortion_vector": [],
Expand All @@ -40,7 +40,7 @@
"process_numbers": 4,
"turntable": {
"steps": 3200,
"radius": 70
"radius": 100
},
"camera": {
"resolution": {
Expand Down
Loading

0 comments on commit 05485b1

Please sign in to comment.