Bedre variabelnavn

This commit is contained in:
Trygve 2022-04-07 20:59:58 +02:00
parent c717f723b6
commit 6df94a2f0d
2 changed files with 21 additions and 21 deletions

View File

@ -23,13 +23,13 @@ class MtrLogFormatter:
'"%s"' % datetime_extracted.strftime('%d.%m.%y %H:%M:%S.000')) '"%s"' % datetime_extracted.strftime('%d.%m.%y %H:%M:%S.000'))
log_line.append( log_line.append(
'"%02d.%02d.%02d %02d:%02d:%02d.%03d"' % ( '"%02d.%02d.%02d %02d:%02d:%02d.%03d"' % (
msg.timestamp_day(), msg.day(),
msg.timestamp_month(), msg.month(),
msg.timestamp_year(), msg.year(),
msg.timestamp_hours(), msg.hours(),
msg.timestamp_minutes(), msg.minutes(),
msg.timestamp_seconds(), msg.seconds(),
msg.timestamp_milliseconds())) msg.milliseconds()))
log_line.append('%06d' % msg.card_id()) log_line.append('%06d' % msg.card_id())
log_line.append('%04d' % 0) # skipped product week log_line.append('%04d' % 0) # skipped product week
log_line.append('%04d' % 0) # skipped product year log_line.append('%04d' % 0) # skipped product year

View File

@ -170,25 +170,25 @@ class MtrStatusMessage:
def mtr_id(self): def mtr_id(self):
return int.from_bytes(self.message_bytes[6:8], 'little') return int.from_bytes(self.message_bytes[6:8], 'little')
def timestamp_year(self): def year(self):
return int.from_bytes(self.message_bytes[8:9], 'little') return int.from_bytes(self.message_bytes[8:9], 'little')
def timestamp_month(self): def month(self):
return int.from_bytes(self.message_bytes[9:10], 'little') return int.from_bytes(self.message_bytes[9:10], 'little')
def timestamp_day(self): def day(self):
return int.from_bytes(self.message_bytes[10:11], 'little') return int.from_bytes(self.message_bytes[10:11], 'little')
def timestamp_hours(self): def hours(self):
return int.from_bytes(self.message_bytes[11:12], 'little') return int.from_bytes(self.message_bytes[11:12], 'little')
def timestamp_minutes(self): def minutes(self):
return int.from_bytes(self.message_bytes[12:13], 'little') return int.from_bytes(self.message_bytes[12:13], 'little')
def timestamp_seconds(self): def seconds(self):
return int.from_bytes(self.message_bytes[13:14], 'little') return int.from_bytes(self.message_bytes[13:14], 'little')
def timestamp_milliseconds(self): def milliseconds(self):
return int.from_bytes(self.message_bytes[14:16], 'little') return int.from_bytes(self.message_bytes[14:16], 'little')
def battery_status(self): def battery_status(self):
@ -214,25 +214,25 @@ class MtrDataMessage:
def mtr_id(self): def mtr_id(self):
return int.from_bytes(self.message_bytes[6:8], 'little') return int.from_bytes(self.message_bytes[6:8], 'little')
def timestamp_year(self): def year(self):
return int.from_bytes(self.message_bytes[8:9], 'little') return int.from_bytes(self.message_bytes[8:9], 'little')
def timestamp_month(self): def month(self):
return int.from_bytes(self.message_bytes[9:10], 'little') return int.from_bytes(self.message_bytes[9:10], 'little')
def timestamp_day(self): def day(self):
return int.from_bytes(self.message_bytes[10:11], 'little') return int.from_bytes(self.message_bytes[10:11], 'little')
def timestamp_hours(self): def hours(self):
return int.from_bytes(self.message_bytes[11:12], 'little') return int.from_bytes(self.message_bytes[11:12], 'little')
def timestamp_minutes(self): def minutes(self):
return int.from_bytes(self.message_bytes[12:13], 'little') return int.from_bytes(self.message_bytes[12:13], 'little')
def timestamp_seconds(self): def seconds(self):
return int.from_bytes(self.message_bytes[13:14], 'little') return int.from_bytes(self.message_bytes[13:14], 'little')
def timestamp_milliseconds(self): def milliseconds(self):
return int.from_bytes(self.message_bytes[14:16], 'little') return int.from_bytes(self.message_bytes[14:16], 'little')
def packet_num(self): def packet_num(self):