fms_pids.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:rpi-can-logger 作者: JonnoFTW 项目源码 文件源码
def __init__(self, pid: int, name: str, parser, fields: [list, str]):
        """
        A class representing an FMSPID and its conversion
        :param pid: The PID
        :param name:  A friendly name of this PID
        :param parser: a function that turns a byte array of at most length 8 into one or more readable values
        :param fields: the friendly name of the outputs of this PID eg. 'RPM'
        """
        self.pid = pid
        self.name = name
        self.parser = parser
        if type(fields) is str:
            self.fields = [fields]
        else:
            self.fields = fields
        self.fieldnames = ['{} ({})'.format(name, unit) for pid_name, unit in
                           zip(cycle([self.name]), self.fields)]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号