lpcmanager

Variable Options : fixed parsing, add On Load fix
som6
2020-11-12, Edouard Tisserant
fecb8381e105
Variable Options : fixed parsing, add On Load fix
- fixed parsing to deal with dblquotes and old bugs better, use intermediate representation once parsed, and add function to generate options string from that representation,
- add On Load fix to be backward compatible with previous options syntax and onchange column
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from modbus.modbus import _ModbusRTUclientPlug, _ModbusRTUslavePlug, RootClass
from LPCArch import GetLPCArch
wrong_uart_name = "ttyS0"
good_uart_name = {"MC9":"ttyAPP3",
"MC10":"ttymxc4"}[GetLPCArch()]
_ModbusRTUclientPlug.XSD = _ModbusRTUclientPlug.XSD.replace(wrong_uart_name,good_uart_name)
_ModbusRTUslavePlug.XSD = _ModbusRTUslavePlug.XSD.replace(wrong_uart_name,good_uart_name)