Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > de.comp.lang.python > #5720

Re: Konstanten in Struct-Form in Python

Path csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From "Michael S." <michaely@bigfoot.de>
Newsgroups de.comp.lang.python
Subject Re: Konstanten in Struct-Form in Python
Date Mon, 22 Feb 2021 07:00:47 +0100
Lines 50
Message-ID <i9gvkcFalukU1@mid.individual.net> (permalink)
References <i9a065FttstU1@mid.individual.net>
Reply-To michael_news2016@gmx.de
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
X-Trace individual.net hlt69ABin3p3jtPItBZswgRRk63RU/DqI/+fEST41uFTim6K7V
Cancel-Lock sha1:HmNJfZjb/VL9tCQjxZFE9shLkJQ=
User-Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1
In-Reply-To <i9a065FttstU1@mid.individual.net>
Content-Language de-DE
Xref csiph.com de.comp.lang.python:5720

Show key headers only | View raw


Am 19.02.2021 um 15:27 schrieb Michael S.:

> Das muss doch auch einfacher gehen.
> 
> Ideen?

Ich habs jetzt so gemacht. Da muss ich in der Anwendung nur die 
CAN-Signals_Klasse instanzieren, dafür halt in der Lib jeweils jedes 
eigene Signal. Aber die Lib wird eh automatisch generiert.

class C_frequency:
	def __init__(self):
		self.ID = "10FC80FC"
		self.BitOffset = 48
		self.BitLength = 8
		self.Gain = 1
		self.ValueOffset = 0
		self.Unit = "Hz"
		self.Rate = 0.5

class C_OutputVoltage:
	def __init__(self):
		self.ID = "25FF1250"
		self.BitOffset = 32
		self.BitLength = 16
		self.Gain = 0.1
		self.ValueOffset = 0
		self.Unit = "V"
		self.Rate = 0.25

class C_Cable_temp:
	def __init__(self):
		self.ID = "12FA5AFC"
		self.BitOffset = 0
		self.BitLength = 8
		self.Gain = 1
		self.ValueOffset = -40
		self.Unit = "°C"
		self.Rate = 10
		
class CAN_Signals:
	def __init__(self):
		self.frequency = C_frequency()
		self.OutputVoltage = C_OutputVoltage()
		self.Cable_temp = C_Cable_temp()



-- 
Michael

Back to de.comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Konstanten in Struct-Form in Python "Michael S." <michaely@bigfoot.de> - 2021-02-19 15:27 +0100
  Re: [Python-de] Konstanten in Struct-Form in Python Hartmut Goebel <h.goebel@crazy-compilers.com> - 2021-02-19 15:43 +0100
  Re: [Python-de] Konstanten in Struct-Form in Python Peter Otten <__peter__@web.de> - 2021-02-20 09:37 +0100
  Re: Konstanten in Struct-Form in Python "Michael S." <michaely@bigfoot.de> - 2021-02-22 07:00 +0100
    Re: Konstanten in Struct-Form in Python Marc 'BlackJack' Rintsch <marc@rintsch.de> - 2021-04-28 10:04 +0000

csiph-web