Browse Source

Fixed: unsuscessful hardware update.

master
Carlos Reding 1 year ago
parent
commit
79784b4408
1 changed files with 72 additions and 0 deletions
  1. 72
    0
      pupuicon/translator/handlers/hardwareVariables.py

+ 72
- 0
pupuicon/translator/handlers/hardwareVariables.py View File

@@ -0,0 +1,72 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 15 20:37:51 2019

@author: RobertBeardmore
"""

import pickle, os

class hardwareVariables():
def __init__(self):
# Set PINs (MODE == BCM).
self.GPIO_PIN_RGB = [17, 27, 22] # RGB mode, simulated white Ws = R + 0.6*G + B.
self.GPIO_PIN_M = 17 # Monocolour mode (white).
self.FILTER_PIN = 3 # Servo holding filters.
self.HEATER_PIN = 10 # Heating unit.
self.cameraRepetitions = 3
self.cameraRepetitions_MIN = 1
self.cameraRepetitions_MAX = 5
# Define servo pulsewidth for each filter position.
self.filter_pws = {}
#self.filter_pws['Filter_1'] = 1775 # 475nm band-pass. Rob: 1715.
#self.filter_pws['Filter_2'] = 1460 # 520nm band-pass (centre). Rob: 1410
#self.filter_pws['Filter_3'] = 1130 # 590 long-pass + 610nm short-pass. Rob: 1075.
#self.filter_pws['No_Filter'] = 850 # No filter (RGB image). Rob: 750.

self.filter_pws['Filter_1'] = 1715 # 475nm band-pass. Rob: 1715.
self.filter_pws['Filter_2'] = 1410 # 520nm band-pass (centre). Rob: 1410
self.filter_pws['Filter_3'] = 1075 # 590 long-pass + 610nm short-pass. Rob: 1075.
self.filter_pws['No_Filter'] = 750 # No filter (RGB image). Rob: 750.


self.filter_MIN = 690
self.filter_MAX = 2280
# Default camera settings
self.DEFAULT_ISO = 10
self.ISO_F1 = 100
self.ISO_F2 = 100
self.ISO_F3 = 400
self.ISO_MIN = 1
self.ISO_MAX = 800
self.SHUTTER_SPEED = 0.25 # Shutter speed time in SECONDS. Defaults to 0.25s
self.SHUTTER_SPEED_MIN = 0.1
self.SHUTTER_SPEED_MAX = 2
# Default light frequency (Hz)
self.DEFAULT_LIGHT_FREQ = 20000
self.LIGHT_FREQ_F1 = 200
self.LIGHT_FREQ_F2 = 200
self.LIGHT_FREQ_F3 = 200
self.LIGHT_FREQ_MIN = 20
self.LIGHT_FREQ_MAX = 20000

def save(self,filename):
filehandler = open(filename, 'wb')
saveObject = self
pickle.dump(saveObject, filehandler)
filehandler.close()
def loadHardwareSettings(filename):
loadedSettings = []
if os.path.exists(filename):
fileHandler = open(filename,"rb")
loadedSettings = pickle.load(fileHandler)
fileHandler.close()
return loadedSettings

Loading…
Cancel
Save