lpcmanager

Added support for MM1 product. Untested.

2022-01-13, Edouard Tisserant
4047f251010d
Parents 9ee9470870eb
Children 88e947924472
Added support for MM1 product. Untested.
  • +1 -1
    LPCArch.py
  • +2 -1
    LPCBus.py
  • +30 -19
    LPCSVGHMI.py
  • --- a/LPCArch.py Tue Oct 05 09:29:49 2021 +0200
    +++ b/LPCArch.py Thu Jan 13 11:49:25 2022 +0100
    @@ -5,7 +5,7 @@
    SVG_GOT_modules = ['GOT_012', 'LHC2_GOT_012']
    MC9_modules = ['MC9', 'MW1']
    SOM28_modules = MC9_modules + WX_GOT_modules
    -SOM6_modules = SVG_GOT_modules
    +SOM6_modules = SVG_GOT_modules + ['MM1']
    product = None
    --- a/LPCBus.py Tue Oct 05 09:29:49 2021 +0200
    +++ b/LPCBus.py Thu Jan 13 11:49:25 2022 +0100
    @@ -32,7 +32,8 @@
    "GOT_111":"GOT100",
    "LHC2_GOT_111":"LHC2_GOT100",
    "GOT_012":"MC10",
    - "LHC2_GOT_012":"MC10"
    + "LHC2_GOT_012":"MC10",
    + "MM1":"MC10"
    }
    bus_template_code = { plc: GetLocalCode(
    --- a/LPCSVGHMI.py Tue Oct 05 09:29:49 2021 +0200
    +++ b/LPCSVGHMI.py Thu Jan 13 11:49:25 2022 +0100
    @@ -2,6 +2,8 @@
    from svghmi.svghmi import SVGHMI, SVGHMILibrary, paths
    import os
    +from LPCArch import GetLPCProduct
    +
    # set default values so that COG browser is managed by SVGHMI
    SVGHMI.XSD = """<?xml version="1.0" encoding="utf-8" ?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    @@ -46,31 +48,40 @@
    """
    old_get_SVGHMI_options = SVGHMI.get_SVGHMI_options
    +product = GetLPCProduct()
    def get_SVGHMI_options(self):
    svghmi_options = old_get_SVGHMI_options(self)
    - portrait = self.GetParamsAttributes("SVGHMI.Portrait")["value"]
    - rotate180 = self.GetParamsAttributes("SVGHMI.Rotate180")["value"]
    - eglfs_angle,touch_angle = {
    - (False,False): ("0","0"),
    - (False,True): ("90","90"),
    - (True,False): ("180","180"),
    - (True,True): ("-90","270")}[(rotate180,portrait)]
    + if product in SVG_GOT_modules:
    +
    + portrait = self.GetParamsAttributes("SVGHMI.Portrait")["value"]
    + rotate180 = self.GetParamsAttributes("SVGHMI.Rotate180")["value"]
    + eglfs_angle,touch_angle = {
    + (False,False): ("0","0"),
    + (False,True): ("90","90"),
    + (True,False): ("180","180"),
    + (True,True): ("-90","270")}[(rotate180,portrait)]
    - # When we were using EVDEV, this was how rotation was done:
    - # 'QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=rotate=' + touch_angle + \
    - browser_commandline = 'TSLIB_CONFFILE=/etc/ts_' + touch_angle + ".conf" \
    - ' QT_QPA_EGLFS_ROTATION=' + eglfs_angle + \
    - ' qt_webenginewidgets_minimal' + \
    - ' --js-flags="--max_old_space_size=16 --gc_interval=100 --optimize_for_size"' + \
    - ' --single-process' + \
    - ' --no-sandbox "' + svghmi_options["url"] + '"'
    + # When we were using EVDEV, this was how rotation was done:
    + # 'QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=rotate=' + touch_angle + \
    + browser_commandline = 'TSLIB_CONFFILE=/etc/ts_' + touch_angle + ".conf" \
    + ' QT_QPA_EGLFS_ROTATION=' + eglfs_angle + \
    + ' qt_webenginewidgets_minimal' + \
    + ' --js-flags="--max_old_space_size=16 --gc_interval=100 --optimize_for_size"' + \
    + ' --single-process' + \
    + ' --no-sandbox "' + svghmi_options["url"] + '"'
    - svghmi_options.update(
    - {"LPCBrowserStart": "sh -c '"+browser_commandline+"'",
    - "LPCBrowserStop": "killall qt_webenginewidgets_minimal",
    - "LPCBrowserRestart": "sh -c 'killall qt_webenginewidgets_minimal; sleep 1; "+browser_commandline+" '"})
    + svghmi_options.update(
    + {"LPCBrowserStart": "sh -c '"+browser_commandline+"'",
    + "LPCBrowserStop": "killall qt_webenginewidgets_minimal",
    + "LPCBrowserRestart": "sh -c 'killall qt_webenginewidgets_minimal; sleep 1; "+browser_commandline+" '"})
    +
    + else:
    + svghmi_options.update(
    + {"LPCBrowserStart": "",
    + "LPCBrowserStop": "",
    + "LPCBrowserRestart": ""})
    return svghmi_options