--- a/LPCBus.py Mon Feb 05 15:48:38 2018 +0100
+++ b/LPCBus.py Mon Feb 05 16:22:09 2018 +0100
@@ -2,6 +2,16 @@
modpath = os.path.split(__file__)[0]
+from LPCArch import GetLPCArch, PLC_module return open(os.path.join(modpath,"LPCBus",fname)).read()
@@ -17,10 +27,6 @@
LPCBusLDFLAGS = { "MC9:On Board" : "-lmbrtu" }
-# to be overloaded at import
from plcopen.structures import LOCATIONDATATYPES
from PLCControler import LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP,\
--- a/LPCCanFestival.py Mon Feb 05 15:48:38 2018 +0100
+++ b/LPCCanFestival.py Mon Feb 05 16:22:09 2018 +0100
@@ -1,6 +1,8 @@
+from ConfigTreeNode import ConfigTreeNode from canfestival import RootClass as CanOpenRootClass
from canfestival.canfestival import _SlaveCTN, _NodeListCTN, NodeManager
from canfestival.NetworkEditor import NetworkEditor
--- a/LPCManager.py Mon Feb 05 15:48:38 2018 +0100
+++ b/LPCManager.py Mon Feb 05 16:22:09 2018 +0100
@@ -20,13 +20,7 @@
# Path of directory containing current python file
_lpcmanager_path = os.path.split(__file__)[0]
-PLC_GOT_module = ['GOT', 'GOT_111', 'GOT_131']
-PLC_MC9_module = ['MC9']
-PLC_module = PLC_MC9_module + PLC_GOT_module
-# XXX get ride of global arch
+from LPCArch import PLC_module, SetLPCArch class LPCManagerLauncher(BeremizIDELauncher):
@@ -45,7 +39,6 @@
print("\n %s Projectpath Buildpath port arch\n" % sys.argv[0])
def ProcessCommandLineArgs(self):
# Command line arguments parsing
opts, args = getopt.getopt(sys.argv[1:], "h", ["help"])
@@ -72,7 +65,7 @@
# overload with exacltly same code, but this is intended.
# we want extensions to use globals of this module, not Beremiz.py
@@ -86,7 +79,7 @@
self.projectOpen = self.BeremizIDE.DecodeFileSystemPath(self.projectOpen, False)
CTR = self.LPCProjectController.LPCProjectController(
- None, CMDpipe, self.buildpath)
+ None, CMDpipe, self.buildpath, self.arch) if self.projectOpen is not None and os.path.isdir(self.projectOpen):
result = CTR.LoadProject(self.projectOpen)
@@ -114,9 +107,6 @@
AddBitmapFolder(os.path.join(_lpcmanager_path, "images"))
-from ProjectController import ProjectController
-from ConfigTreeNode import ConfigTreeNode
-from editors.ProjectNodeEditor import ProjectNodeEditor
from editors.ConfTreeNodeEditor import ConfTreeNodeEditor
from editors.CodeFileEditor import VariablesTable
from editors.CodeFileEditor import VariablesEditor
@@ -822,15 +812,6 @@
PLCControler.GenerateNewName = newGenerateNewName
-import LPCBus as LPCBus_mod
- LPCBus_mod.LPCarch = "MC9"
- LPCBus_mod.LPCarch = arch
if __name__ == '__main__':
--- a/LPCProjectController.py Mon Feb 05 15:48:38 2018 +0100
+++ b/LPCProjectController.py Mon Feb 05 16:22:09 2018 +0100
@@ -6,6 +6,7 @@
from ProjectController import ProjectController
+from LPCArch import PLC_module def mycopytree(src, dst):
@@ -28,13 +29,15 @@
[SIMULATION_MODE, TRANSFER_MODE] = range(2)
- class LPCProjectNodeEditor(ProjectNodeEditor):
- class LPCProjectNodeEditor(ProjectNodeEditor):
- ENABLE_REQUIRED = False
+# TODO : re-consider customization for MC8 +# from editors.ProjectNodeEditor import ProjectNodeEditor +# if arch in PLC_module: +# class LPCProjectNodeEditor(ProjectNodeEditor): +# class LPCProjectNodeEditor(ProjectNodeEditor): +# ENABLE_REQUIRED = False @@ -79,12 +82,12 @@
"Connected": [("_Simulate", "not simulating"),
- ("_Stop", True if arch in PLC_module else "simulating"),
+ ("_Stop", True), # TODO: if arch in PLC_module else "simulating"), "Disconnected": [("_Simulate", "not simulating"),
- ("_Stop", False if arch in PLC_module else "simulating"),
+ ("_Stop", False), # TODO: if arch in PLC_module else "simulating"), "Empty" :[("_Simulate", "not simulating"),
@@ -94,37 +97,38 @@
- "tooltip": _("Connect to the target PLC"),
- {"bitmap": "Disconnect",
- "name": _("Disconnect"),
- "tooltip": _("Disconnect from PLC"),
- "method": "_Disconnect"},
- "tooltip": _("Update the PLC firmware"),
- "method": "_UpdateFw"},
- _MethodFromPLCState["Disconnected"] += [("_Connect", True),
- ("_Disconnect", False)]
+# TODO # if arch in PLC_module: + "tooltip": _("Connect to the target PLC"), + {"bitmap": "Disconnect", + "name": _("Disconnect"), + "tooltip": _("Disconnect from PLC"), + "method": "_Disconnect"}, + "tooltip": _("Update the PLC firmware"), + "method": "_UpdateFw"}, +_MethodFromPLCState["Disconnected"] += [("_Connect", True), + ("_Disconnect", False)] - _MethodFromPLCState["Connected"] += [("_Connect", False),
+_MethodFromPLCState["Connected"] += [("_Connect", False), class LPCProjectController(ProjectController):
StatusMethods = _StatusMethods
- EditorType = LPCProjectNodeEditor
+ # TODO : re-consider customization for MC8 + # EditorType = LPCProjectNodeEditor - def __init__(self, frame, logger, buildpath):
+ def __init__(self, frame, logger, buildpath, arch): self.OrigBuildPath = buildpath
@@ -133,7 +137,7 @@
self.CTNChildrenTypes += [("LPCBus", LPCBus, "LPC bus"), ("CanOpen", LPCCanOpen, "CanOpen bus")]
- self.OnlineMode = "NORMAL" if arch in PLC_module else "OFF"
+ self.OnlineMode = "NORMAL" if self.arch in PLC_module else "OFF" self.ConnectorPath = None
@@ -163,7 +167,7 @@
target = ProjectController.GetTarget(self)
- if self.CurrentMode != SIMULATION_MODE and arch not in PLC_module:
+ if self.CurrentMode != SIMULATION_MODE and self.arch not in PLC_module: target.getcontent().setBuildPath(self.BuildPath)
@@ -210,7 +214,7 @@
def SetOnlineMode(self, mode, path=None):
# SetOnlineMode is only for MC8
+ if self.arch in PLC_module: @@ -371,7 +375,7 @@
wx.CallAfter(self.RefreshConfNodesBlockLists)
+ if self.arch in PLC_module: self.SetParamsAttribute('BeremizRoot.TargetType', 'MC9')
@@ -682,12 +686,12 @@
builder = self.GetBuilder()
- builder.ResetBinaryCodeMD5(*([] if arch in PLC_module else [self.OnlineMode]))
+ builder.ResetBinaryCodeMD5(*([] if self.arch in PLC_module else [self.OnlineMode])) def GetLastBuildMD5(self):
builder = self.GetBuilder()
- return builder.GetBinaryCodeMD5(*([] if arch in PLC_module else [self.OnlineMode]))
+ return builder.GetBinaryCodeMD5(*([] if self.arch in PLC_module else [self.OnlineMode]))