Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added new average calculation for the values * add everage * changed formular * updaed * fixed spelling and some other errors * added todo * Switched to poetry and venv * some linting * added pre-commit * reformatted with black * change code from index to new file * added the config menue / modal * added vscode * mocked spidev in dev mode * fixed some spelling ?? * Added blinking * updated blinking to invisable * added comment * deleted unused png * added legend bottom right * run pre-commit on all files * change to config instead of global variables * changed the AFR calculation * added error check * added pyinstaller * fixed exception if ENV not set * fixed know issue in package eventlet/eventlet#702 * fixed exception if ENV not set * changed config and can change correction from web interface * added devcontainer * some code fixes (#7) * nachkomastellen default zu 2 (#8) * Set blinking and removed error warning (#10) * blinking is in settings * removed error checking * #9 save all setting (#13) * all settings getting saved * switched to dynamic attributes in config * use of url_for * setup the default values and the persistent saving in the backend * updated black * added example settings and use this if not prod * removed unused settings * update README für neue Settings * removed unused import * added jinja extension * #12 exceptions anzeigen (#14) * renamend .html to .jinja * renamend THREAD to UPDATE_DATA_THREAD and initialize it with None * Exceptions werden nun angezeigt * #16 New temperaturanzeige (#23) * Basisklasse für GPIO erstellt und LambdaSensor daraus abgeleitet * Added typ_k_tempreatursensor and apply snake_case to lambda_sensor * submit temperaturdata to webpage * splittet lamda functions and placed channels to config file * added new config in exaple file create base template. Working moved javascript around switched back to index.jinja * lambda und temp werden nun von anfang an auf 50% im index angezeigt * Tempreaturanzeige wird nun syncronisiert vom Back to Frontend * alphabetic order * alle Anzeigen können nun individuell angezeigt werden und in conf eingestellt * apply orange and red colors * Temp min max verlauf (#24) * tmp_commit added charts rev * added diagramm with test data * added sqlite db and tempdata routes * implemented firs working chart for temperatur * Create own page for history * switched to date and time imstead of datetime-local * add nav and hisotry generator tool * added bg color for chart * added second timestamp for temprature * added lambda values for charts * removed influxdb * generate better example values * added timezone to db timestamps * fixed labes for data * fixed some type errors * swtiched to own CSS layout * changed the main Layout to own CSS * tracking the sensor lifetime and show warnings (#25) * added overheating (#26) * updated readme * update python version to 3.7.*
- Loading branch information
1 parent
3bb6877
commit 1884de6
Showing
39 changed files
with
2,698 additions
and
1,413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,41 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/python | ||
{ | ||
"image": "python:3.7.3", | ||
"forwardPorts": [8080], | ||
"customizations": { | ||
// Configure properties specific to VS Code. | ||
"vscode": { | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"ms-python.python", | ||
"njpwerner.autodocstring", | ||
"naumovs.color-highlight", | ||
"GitHub.copilot", | ||
"donjayamanne.githistory", | ||
"mhutchie.git-graph", | ||
"oderwat.indent-rainbow", | ||
"ms-python.vscode-pylance", | ||
"Gruntfuggly.todo-tree", | ||
"yzhang.markdown-all-in-one" | ||
] | ||
} | ||
}, | ||
"name": "Python 3", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"image": "mcr.microsoft.com/devcontainers/python:3.7", | ||
"features": { | ||
"ghcr.io/devcontainers/features/git:1": {}, | ||
"ghcr.io/devcontainers-contrib/features/poetry:1": {} | ||
"ghcr.io/devcontainers-contrib/features/poetry:2.0.17": {} | ||
}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
"forwardPorts": [8080], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "poetry config virtualenvs.in-project true && poetry install", | ||
|
||
// Configure tool-specific properties. | ||
"customizations": { | ||
"vscode": { | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"ms-python.python", | ||
"njpwerner.autodocstring", | ||
"naumovs.color-highlight", | ||
"GitHub.copilot", | ||
"donjayamanne.githistory", | ||
"mhutchie.git-graph", | ||
"oderwat.indent-rainbow", | ||
"ms-python.vscode-pylance", | ||
"Gruntfuggly.todo-tree", | ||
"yzhang.markdown-all-in-one", | ||
"samuelcolvin.jinjahtml" | ||
] | ||
} | ||
}, | ||
|
||
"remoteEnv": { | ||
"FLASK_ENV": "development" | ||
}, | ||
"postCreateCommand": "poetry config virtualenvs.in-project true && poetry install" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"image": "python:3.7.3", | ||
"forwardPorts": [8080], | ||
"customizations": { | ||
// Configure properties specific to VS Code. | ||
"vscode": { | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"ms-python.python", | ||
"njpwerner.autodocstring", | ||
"naumovs.color-highlight", | ||
"GitHub.copilot", | ||
"donjayamanne.githistory", | ||
"mhutchie.git-graph", | ||
"oderwat.indent-rainbow", | ||
"ms-python.vscode-pylance", | ||
"Gruntfuggly.todo-tree", | ||
"yzhang.markdown-all-in-one", | ||
"samuelcolvin.jinjahtml" | ||
] | ||
} | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/git:1": {}, | ||
"ghcr.io/devcontainers-contrib/features/poetry:1": {} | ||
}, | ||
"remoteEnv": { | ||
"FLASK_ENV": "development" | ||
}, | ||
"postCreateCommand": "poetry config virtualenvs.in-project true && poetry install" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,7 @@ htmlcov/ | |
|
||
dist/ | ||
build/ | ||
*.egg-info/ | ||
*.egg-info/ | ||
|
||
settings.json | ||
MAMA.sqlite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,26 @@ | ||
import os | ||
|
||
from globale_variablen import config | ||
from MCP3008 import MCP3008 | ||
from MCP3008 import TestMCP3008 | ||
|
||
|
||
class GPIO_Reader(object): | ||
""" | ||
Klasse womit der Aktuelle Lamdawert am GPIO Einglang ausgelesen werden kann | ||
""" | ||
class GPIO(object): | ||
"""Basis Klasse für die GPIO Schnittstelle""" | ||
|
||
def __init__(self): | ||
def __init__(self, *args, **kwargs): | ||
"""Handelt es sich um eine Testumgebung wird ein TestMCP3008 Objekt erstellt, ansonsten ein MCP3008 Objekt""" | ||
if os.environ.get("FLASK_ENV") == "development": | ||
self.adc = TestMCP3008() | ||
print("Create TestMCP3008 Object") | ||
self.adc = TestMCP3008(*args, **kwargs) | ||
else: | ||
self.adc = MCP3008() | ||
self.adc = MCP3008(*args, **kwargs) | ||
|
||
def get_voltage(self, channel: int) -> float: | ||
"""Gibt den Spannungswert des angegebenen Kanals zurück | ||
:param channel: Kanalnummer (0-7) | ||
:return: Spannungswert (0-5V) | ||
""" | ||
value = self.adc.read(channel) | ||
voltage = value / 1023.0 * 5.0 | ||
return voltage | ||
|
||
def get_lamda(self, voltage: float, correction: float) -> float: | ||
lamda = round(0.2 * voltage + correction, 3) | ||
return lamda | ||
|
||
def get_afr(self, lamda: float) -> float: | ||
afr = lamda * config.AFR_STOCH | ||
return afr | ||
|
||
def getData(self): | ||
voltage_1 = self.get_voltage(0) | ||
voltage_2 = self.get_voltage(1) | ||
|
||
lamda_1 = round(self.get_lamda(voltage_1, config.KORREKTURFAKTOR_BANK_1), 3) | ||
lamda_2 = round(self.get_lamda(voltage_2, config.KORREKTURFAKTOR_BANK_2), 3) | ||
|
||
afr_1 = self.get_afr(lamda_1) | ||
afr_2 = self.get_afr(lamda_2) | ||
|
||
data = { | ||
"lamda1": lamda_1, | ||
"lamda2": lamda_2, | ||
"afr1": afr_1, | ||
"afr2": afr_2, | ||
"volt1": voltage_1, | ||
"volt2": voltage_2, | ||
} | ||
return data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.