def flaskReprogram(): scenario = int(request.args.get("scenario","1")) if scenario == 1: reprogram.reprogramNvmdefault(1, "bytecodeLightSensorV1.h") return "reprogrammed to scenario 1" if scenario == 2: reprogram.reprogramNvmdefault(1, "bytecodeLightSensorV2.h") return "reprogrammed to scenario 2" else: return ""
def flaskReprogram(): global busyReprogramming busyReprogramming = True scenario = int(request.args.get("scenario","1")) if scenario == 1: reprogram.reprogramNvmdefault(3, "bytecodeHA1.h") reprogram.reprogramNvmdefault(1, "bytecodeHA1.h") time.sleep(3) busyReprogramming = False return "reprogrammed to scenario 1" if scenario == 2: reprogram.reprogramNvmdefault(3, "bytecodeHA2.h") reprogram.reprogramNvmdefault(1, "bytecodeHA2.h") time.sleep(3) busyReprogramming = False return "reprogrammed to scenario 2" else: busyReprogramming = False return ""