# HG changeset patch # User Laurent Bessard # Date 1361530466 -3600 # Node ID 735464c8616a3192fae2e3bea6ad142cd909f71d # Parent c5b5509bd224245147324981b73a145a6794ffd3 Added parameter in command line for defining main control module type (conditioning canopen interface availability) diff -r c5b5509bd224 -r 735464c8616a LPCManager.py --- a/LPCManager.py Wed Feb 20 19:17:49 2013 +0100 +++ b/LPCManager.py Fri Feb 22 11:54:26 2013 +0100 @@ -16,8 +16,8 @@ if __name__ == '__main__': def usage(): - print "\nUsage of LPCBeremiz.py :" - print "\n %s Projectpath Buildpath port\n"%sys.argv[0] + print "\nUsage of LPCManager.py :" + print "\n %s Projectpath Buildpath port [arch]\n"%sys.argv[0] try: opts, args = getopt.getopt(sys.argv[1:], "h", ["help"]) @@ -31,7 +31,7 @@ usage() sys.exit() - if len(args) != 3: + if len(args) < 3 or len(args) > 4: usage() sys.exit() else: @@ -42,6 +42,10 @@ except: usage() sys.exit() + if len(args) > 3: + arch = args[3] + else: + arch = "MC8" if os.path.exists("LPC_DEBUG"): __builtin__.__dict__["BMZ_DBG"] = True @@ -888,12 +892,15 @@ #Load and init all the children self.LoadChildren() - if havecanfestival and self.GetChildByName("CanOpen") is None: + canopen_child = self.GetChildByName("CanOpen") + if arch == "MC8" and havecanfestival and canopen_child is None: canopen = self.CTNAddChild("CanOpen", "CanOpen", 0) - #canopen.BaseParams.setEnabled(False) canopen.LoadChildren() canopen.CTNRequestSave() + elif (arch != "MC8" or not havecanfestival) and canopen_child is not None: + canopen_child.CTNRemove() + if self.CTNTestModified(): self.SaveProject() @@ -1811,14 +1818,14 @@ while idx == -1: text = self.socket.recv(2048) if text == "": - break + return "" self.Buffer += text idx = self.Buffer.find("\n") if idx != -1: line = self.Buffer[:idx+1] self.Buffer = self.Buffer[idx+1:] if BMZ_DBG: - print "command >"+line+str(len(line)) + print "command >"+line return line return ""