diff --git a/controllerApp/controllerApp.pde b/controllerApp/controllerApp.pde index 91c57d22a6a79b205a39ef75deb0741be6512fa0..d033b1d8502fd5e9bbb9c7bbb791689661cc07d5 100644 --- a/controllerApp/controllerApp.pde +++ b/controllerApp/controllerApp.pde @@ -50,14 +50,18 @@ void onFlick( float x, float y, float px, float py, float v) void onPinch(float x, float y, float d) { - Size = constrain(Size+d, 1, 2000); - net.sendPinch(x, y, d); + if (d != 0){ + Size = constrain(Size+d, 1, 2000); + net.sendPinch(x, y, d); + } } void onRotate(float x, float y, float ang) { - Angle += ang; - net.sendRotation(x, y, ang); + if (ang != 0){ + Angle += ang; + net.sendRotation(x, y, ang); + } } //these still work if we forward MotionEvents below diff --git a/controllerPackage/controller/__pycache__/mobile.cpython-37.pyc b/controllerPackage/controller/__pycache__/mobile.cpython-37.pyc index 4acd6c8c635238d78613519f6f3724a877be60a2..34e2be9c24f843ecfdad2392e5acabeda68dd515 100644 Binary files a/controllerPackage/controller/__pycache__/mobile.cpython-37.pyc and b/controllerPackage/controller/__pycache__/mobile.cpython-37.pyc differ diff --git a/controllerPackage/controller/mobile.py b/controllerPackage/controller/mobile.py index 82ce8d8766c2b7733e5ac5726b38643632387e80..ff39ff4a1c308fbf314fb7e3541ce6a9e4474d33 100644 --- a/controllerPackage/controller/mobile.py +++ b/controllerPackage/controller/mobile.py @@ -9,6 +9,7 @@ class Mobile: print('Its not my problem') else: print('ill handle it!') + print(data) def on_left_swipe(self): if self.help: print('[LEFT SWIPE DETECTED] You can overwrite on_left_swipe to handle it.') diff --git a/controllerPackage/test.py b/controllerPackage/test.py index e1ca7f4bbbcde61c79ab8965cc433aa87f1213d5..c7045e2516c61908a045e899288e77cce91c2c4e 100644 --- a/controllerPackage/test.py +++ b/controllerPackage/test.py @@ -4,5 +4,5 @@ from time import sleep c = Controller('a1b2c3') c.connect() print('luckly..') -sleep(3) -c.disconnect() + + diff --git a/controllerSite/controllerSite.py b/controllerSite/controllerSite.py index 425319b8431e09ae202c84337b9eb06a0af92440..f72720133c80ac0d336facdb1f78ee55c3f2de6f 100644 --- a/controllerSite/controllerSite.py +++ b/controllerSite/controllerSite.py @@ -30,11 +30,14 @@ def allowed_file(filename): def multicast(code): if request.method == 'POST': content = request.json - print(content) - print(code,content['id']) - with app.app_context(): - socketio.emit('multicast', request.get_json(), broadcast = True,namespace='/'+code) - return jsonify({"code":code,"id":content['id']}) + if not 'id' in content: + print('[PROBLEM]',content) + return jsonify({}) + else: + print(code,content['id']) + with app.app_context(): + socketio.emit('multicast', request.get_json(), broadcast = True,namespace='/'+code) + return jsonify({"code":code,"id":content['id']}) return ''' <!doctype html> <title>Use a HTTP POST Request</title> @@ -45,7 +48,7 @@ def confirmReception(): @socketio.on('code') def handle_code(json, methods=['GET', 'POST']): print('code received: ' + str(json)) - socketio.emit('message', json, callback=confirmReception,namespace='/a1b2c3') + socketio.emit('message', json,namespace='/a1b2c3') if __name__ == '__main__': socketio.run(app,debug = True,host = "0.0.0.0",port = 80)