fix output class calling
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
import json
|
||||
|
||||
from flask import Blueprint, render_template, request, flash, jsonify
|
||||
from gpio_handler import gpio_set_pulse
|
||||
from gpio_handler import create_output
|
||||
|
||||
views = Blueprint('views', __name__)
|
||||
|
||||
# gpio channels
|
||||
r_ch1 = 26
|
||||
r_ch2 = 20
|
||||
r_ch3 = 21
|
||||
# tap channels
|
||||
tap_left=26
|
||||
tap_right=20
|
||||
|
||||
# wait times
|
||||
t_large_beer = 6
|
||||
t_small_beer = 2
|
||||
# create ouput handler
|
||||
output = create_output()
|
||||
|
||||
@views.route('/', methods=['GET'])
|
||||
def render():
|
||||
@@ -22,10 +20,10 @@ def render():
|
||||
def choice():
|
||||
if request.form['submit_button'] == 'option_1':
|
||||
print("Eis usem lingge Gütterli uselah!")
|
||||
gpio_set_pulse(channel=r_ch1, time_on=t_large_beer)
|
||||
output.gpio_set_pulse(channel=tap_left, time_on=6)
|
||||
if request.form['submit_button'] == 'option_2':
|
||||
print("Eis usem rächte Gütterli uselah!")
|
||||
gpio_set_pulse(channel=r_ch2, time_on=t_large_beer)
|
||||
output.gpio_set_pulse(channel=tap_right, time_on=6)
|
||||
return render_template('beertap.html')
|
||||
|
||||
@views.route('/about', methods=['GET'])
|
||||
|
||||
Reference in New Issue
Block a user