mirror of
https://codeberg.org/mclemens/AntennaPi.git
synced 2024-06-13 11:00:51 +00:00
code cleanup
This commit is contained in:
parent
b89488f602
commit
4558b9d6f4
10
antennapi.py
10
antennapi.py
|
@ -10,12 +10,10 @@ GPIO.setwarnings(False)
|
||||||
|
|
||||||
RELAIS_1_GPIO = 0
|
RELAIS_1_GPIO = 0
|
||||||
RELAIS_2_GPIO = 1
|
RELAIS_2_GPIO = 1
|
||||||
|
|
||||||
GPIO.setup(RELAIS_1_GPIO, GPIO.OUT)
|
GPIO.setup(RELAIS_1_GPIO, GPIO.OUT)
|
||||||
GPIO.setup(RELAIS_2_GPIO, GPIO.OUT)
|
GPIO.setup(RELAIS_2_GPIO, GPIO.OUT)
|
||||||
|
|
||||||
#GPIO.output(RELAIS_1_GPIO, GPIO.HIGH)
|
|
||||||
#GPIO.output(RELAIS_2_GPIO, GPIO.HIGH)
|
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def start():
|
def start():
|
||||||
return render_template('index.html')
|
return render_template('index.html')
|
||||||
|
@ -25,21 +23,15 @@ def index():
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
if request.form['ant_button'] == 'Antenna 1':
|
if request.form['ant_button'] == 'Antenna 1':
|
||||||
GPIO.output(RELAIS_2_GPIO, GPIO.HIGH)
|
GPIO.output(RELAIS_2_GPIO, GPIO.HIGH)
|
||||||
time.sleep(1)
|
|
||||||
GPIO.output(RELAIS_1_GPIO, GPIO.LOW)
|
GPIO.output(RELAIS_1_GPIO, GPIO.LOW)
|
||||||
print('Antenna 1 selected')
|
|
||||||
return redirect(url_for('start'))
|
return redirect(url_for('start'))
|
||||||
if request.form['ant_button'] == 'Antenna 2':
|
if request.form['ant_button'] == 'Antenna 2':
|
||||||
GPIO.output(RELAIS_1_GPIO, GPIO.HIGH)
|
GPIO.output(RELAIS_1_GPIO, GPIO.HIGH)
|
||||||
time.sleep(1)
|
|
||||||
GPIO.output(RELAIS_2_GPIO, GPIO.LOW)
|
GPIO.output(RELAIS_2_GPIO, GPIO.LOW)
|
||||||
print('Antenna 2 selected')
|
|
||||||
return redirect(url_for('start'))
|
return redirect(url_for('start'))
|
||||||
if request.form['ant_button'] == 'Antenna 3':
|
if request.form['ant_button'] == 'Antenna 3':
|
||||||
GPIO.output(RELAIS_1_GPIO, GPIO.HIGH)
|
GPIO.output(RELAIS_1_GPIO, GPIO.HIGH)
|
||||||
time.sleep(1)
|
|
||||||
GPIO.output(RELAIS_2_GPIO, GPIO.HIGH)
|
GPIO.output(RELAIS_2_GPIO, GPIO.HIGH)
|
||||||
print('Antenna 2 selected')
|
|
||||||
return redirect(url_for('start'))
|
return redirect(url_for('start'))
|
||||||
else:
|
else:
|
||||||
print(request.form.action)
|
print(request.form.action)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user