def build_firmware_handler(): ret = [] buildname = "LasaurGrbl_from_src" firmware_dir = os.path.join(resources_dir(), 'firmware') source_dir = os.path.join(resources_dir(), 'firmware', 'src') return_code = build_firmware(source_dir, firmware_dir, buildname) if return_code != 0: print ret ret.append('<h2>FAIL: build error!</h2>') ret.append('Syntax error maybe? Try builing in the terminal.') ret.append('<br><a href="/">return</a><br><br>') else: print "SUCCESS: firmware built." ret.append('<h2>SUCCESS: new firmware built!</h2>') ret.append('<br><a href="/flash_firmware/'+buildname+'.hex">Flash Now!</a><br><br>') return ''.join(ret)
if args.debug: debug(True) if hasattr(sys, "_MEIPASS"): print "Data root is: " + sys._MEIPASS if args.flash: return_code = flash_upload(SERIAL_PORT, resources_dir(), FIRMWARE, HARDWARE) if return_code == 0: print "SUCCESS: Arduino appears to be flashed." else: print "ERROR: Failed to flash Arduino." elif args.build_flash: # build buildname = "LasaurGrbl_from_src" firmware_dir = os.path.join(resources_dir(), 'firmware') source_dir = os.path.join(resources_dir(), 'firmware', 'src') return_code = build_firmware(source_dir, firmware_dir, buildname) if return_code != 0: print ret else: print "SUCCESS: firmware built." # flash return_code = flash_upload(SERIAL_PORT, resources_dir(), FIRMWARE, HARDWARE) if return_code == 0: print "SUCCESS: Arduino appears to be flashed." else: print "ERROR: Failed to flash Arduino." else: if args.host_on_all_interfaces: run_with_callback('', NETWORK_PORT) else: print 'jiefool'
if args.debug: debug(True) if hasattr(sys, "_MEIPASS"): print "Data root is: " + sys._MEIPASS if args.flash: return_code = flash_upload(SERIAL_PORT, resources_dir(), FIRMWARE, HARDWARE) if return_code == 0: print "SUCCESS: Arduino appears to be flashed." else: print "ERROR: Failed to flash Arduino." elif args.build_flash: # build buildname = "LasaurGrbl_from_src" firmware_dir = os.path.join(resources_dir(), 'firmware') source_dir = os.path.join(resources_dir(), 'firmware', 'src') return_code = build_firmware(source_dir, firmware_dir, buildname) if return_code != 0: print ret else: print "SUCCESS: firmware built." # flash return_code = flash_upload(SERIAL_PORT, resources_dir(), FIRMWARE, HARDWARE) if return_code == 0: print "SUCCESS: Arduino appears to be flashed." else: print "ERROR: Failed to flash Arduino." else: if args.host_on_all_interfaces: run_with_callback('', NETWORK_PORT) else: run_with_callback('127.0.0.1', NETWORK_PORT)