-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from kaulketh/develop
emergency stop implemented
- Loading branch information
Showing
21 changed files
with
336 additions
and
303 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
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,16 +1,10 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
# configs, constants and methods | ||
# configs, command strings and constants | ||
# author: Thomas Kaulke, [email protected] | ||
|
||
from __future__ import absolute_import | ||
import time | ||
import RPi.GPIO as GPIO | ||
import conf.access as access | ||
import logger.logger as log | ||
|
||
"""logging is configured in logger package in logger_config.ini""" | ||
logging = log.get_logger('config') | ||
|
||
# language selection | ||
""" for English import greenhouse_lib_english """ | ||
|
@@ -32,18 +26,7 @@ | |
[lib.stop_bot, lib.live_stream, lib.reload] | ||
] | ||
kb2 = [[lib.cancel, lib.stop_bot]] | ||
|
||
|
||
# to use Raspberry Pi board pin numbers | ||
def set_pins(): | ||
GPIO.setmode(GPIO.BOARD) | ||
logging.info('Set GPIO mode: GPIO.BOARD') | ||
# to use GPIO instead board pin numbers, then please adapt pin definition | ||
# GPIO.setmode(GPIO.BCM) | ||
# comment if warnings required | ||
GPIO.setwarnings(False) | ||
return GPIO | ||
|
||
kb3 = [[lib.emergency_stop]] | ||
|
||
# 7-segment display settings | ||
clk_pin = 32 | ||
|
@@ -88,38 +71,5 @@ def set_pins(): | |
run_gpio_check = 'sudo python /home/pi/scripts/TelegramBot/gpio_check.py ' | ||
|
||
|
||
# switch functions | ||
def switch_on(pin): | ||
logging.info('switch on: ' + str(pin)) | ||
GPIO.setup(pin, GPIO.OUT) | ||
GPIO.output(pin, GPIO.LOW) | ||
# os.system(run_gpio_check + str(pin)) | ||
return | ||
|
||
|
||
def switch_off(pin): | ||
logging.info('switch off: ' + str(pin)) | ||
GPIO.setup(pin, GPIO.OUT) | ||
GPIO.output(pin, GPIO.HIGH) | ||
# os.system(run_gpio_check + str(pin)) | ||
GPIO.cleanup(pin) | ||
return | ||
|
||
|
||
# date time strings | ||
def get_timestamp(): | ||
return time.strftime('[%d.%m.%Y %H:%M:%S] ') | ||
|
||
|
||
def get_timestamp_line(): | ||
return time.strftime('`[%d.%m.%Y %H:%M:%S]\n---------------------\n`') | ||
|
||
|
||
# gets the state of pin, if 0 is switched on | ||
def get_pin_state(pin): | ||
GPIO.setup(pin, GPIO.OUT) | ||
return GPIO.input(pin) | ||
|
||
|
||
if __name__ == '__main__': | ||
pass |
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
This file was deleted.
Oops, something went wrong.
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.