Porównaj commity

...

4 Commity

Autor SHA1 Wiadomość Data
jbruce 8b39f96d39 sane defaults for config 2023-01-10 14:07:19 -05:00
Jason Bruce 78f88ea418
Merge pull request #128 from chipgarner/blinka
Blinka
2023-01-10 14:01:02 -05:00
Chip Garner 0485ed961a Merge branch 'blinka' of https://github.com/jbruce12000/kiln-controller into blinka 2023-01-02 20:33:22 -08:00
Chip Garner 5b1c516260 Works with MAX31856 2023-01-02 20:33:15 -08:00
4 zmienionych plików z 17 dodań i 14 usunięć

1
.gitignore vendored
Wyświetl plik

@ -9,3 +9,4 @@ thumbs.db
#config.py
.idea/*
state.json
venv/*

Wyświetl plik

@ -60,10 +60,11 @@ except NotImplementedError:
### Thermocouple Adapter selection:
# max31855 - bitbang SPI interface
# max31856 - bitbang SPI interface. must specify thermocouple_type.
max31855 = 1
max31856 = 0
# uncomment this if using MAX-31856
#thermocouple_type = ThermocoupleType.S
max31855 = 0
max31856 = 1
# uncomment these two lines if using MAX-31856
import adafruit_max31856
thermocouple_type = adafruit_max31856.ThermocoupleType.K
# here are the possible max-31856 thermocouple types
# ThermocoupleType.B
@ -116,7 +117,7 @@ stop_integral_windup = True
#
# Simulation parameters
simulate = True
sim_t_env = 255 # deg C
sim_t_env = 65 # deg
sim_c_heat = 500.0 # J/K heat capacity of heat element
sim_c_oven = 5000.0 # J/K heat capacity of oven
sim_p_heat = 5450.0 # W heating power of oven
@ -124,7 +125,10 @@ sim_R_o_nocool = 0.5 # K/W thermal resistance oven -> environment
sim_R_o_cool = 0.05 # K/W " with cooling
sim_R_ho_noair = 0.1 # K/W thermal resistance heat element -> oven
sim_R_ho_air = 0.05 # K/W " with internal air circulation
sim_speedup_factor = 1000
# if you want simulations to happen faster than real time, this can be
# set as high as 1000 to speed simulations up by 1000 times.
sim_speedup_factor = 1
########################################################################

Wyświetl plik

@ -14,9 +14,7 @@ from geventwebsocket.handler import WebSocketHandler
from geventwebsocket import WebSocketError
try:
sys.dont_write_bytecode = True
import config
sys.dont_write_bytecode = False
except:
print ("Could not import config file.")
print ("Copy config.py.EXAMPLE to config.py and adapt it for your setup.")

Wyświetl plik

@ -289,12 +289,12 @@ class Max31856(TempSensorReal):
TempSensorReal.__init__(self)
log.info("thermocouple MAX31856")
import adafruit_max31856
adafruit_max31856.ThermocoupleType(config.thermocouple_type)
self.thermocouple = adafruit_max31856.MAX31856(self.spi,self.cs)
self.thermocouple = adafruit_max31856.MAX31856(self.spi,self.cs,
thermocouple_type=config.thermocouple_type)
if (config.ac_freq_50hz == True):
self.thermocouple.noise_rejection(50)
self.thermocouple.noise_rejection = 50
else:
self.thermocouple.noise_rejection(60)
self.thermocouple.noise_rejection = 60
def raw_temp(self):
# The underlying adafruit library does not throw exceptions
@ -303,7 +303,7 @@ class Max31856(TempSensorReal):
# dict for errors and raise an exception.
# and raise Max31856_Error(message)
temp = self.thermocouple.temperature
for k,v in self.thermocouple.fault:
for k,v in self.thermocouple.fault.items():
if v:
raise Max31856_Error(k)
return temp
@ -664,7 +664,7 @@ class RealOven(Oven):
def heat_then_cool(self):
pid = self.pid.compute(self.target,
self.board.temp_sensor.temperature +
self.board.temp_sensor.temperature() +
config.thermocouple_offset, datetime.datetime.now())
heat_on = float(self.time_step * pid)