Skip to content

Conversation

@sourcery-ai
Copy link

@sourcery-ai sourcery-ai bot commented Feb 15, 2023

Branch main refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the main branch, then run:

git fetch origin sourcery/main
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from readcoil February 15, 2023 03:17
Comment on lines -8 to +9
mac = mac[0:6] + 'fffe' + mac[6:]
return hex(int(mac[0:2], 16) ^ 2)[2:] + mac[2:]
mac = f'{mac[:6]}fffe{mac[6:]}'
return hex(int(mac[:2], 16) ^ 2)[2:] + mac[2:]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function mac2eui refactored with the following changes:

def get_millis():
millisecond = time.ticks_ms()
return millisecond
return time.ticks_ms()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_millis refactored with the following changes:

Comment on lines -17 to +16
node_name = "ESP_" + uuid
return node_name
return f"ESP_{uuid}"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_nodename refactored with the following changes:

Comment on lines 22 to 26
if example == 'sender':
LoRaSender.send(lora)
if example == 'receiver':
LoRaReceiver.receive(lora)
LoRaReceiver.receive(lora)
elif example == 'sender':
LoRaSender.send(lora)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 23-26 refactored with the following changes:

  • Simplify conditional into switch-like form (switch)

oled.fill(0)
for row, text in enumerate(screen):
print("{} - {}".format(row, text))
print(f"{row} - {text}")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function write_screen refactored with the following changes:

Comment on lines -271 to +277
bins = (7.8E3, 10.4E3, 15.6E3, 20.8E3, 31.25E3, 41.7E3, 62.5E3, 125E3, 250E3)

bw = 9

if sbw < 10:
bw = sbw
else:
bins = (7.8E3, 10.4E3, 15.6E3, 20.8E3, 31.25E3, 41.7E3, 62.5E3, 125E3, 250E3)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SX127x.set_signal_bandwidth refactored with the following changes:


payload = bytearray()
for i in range(packet_length):
for _ in range(packet_length):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SX127x.read_payload refactored with the following changes:


def blink_led(self, times = 1, on_seconds = 0.1, off_seconds = 0.1):
for i in range(times):
for _ in range(times):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SX127x.blink_led refactored with the following changes:

gc.collect()
if __DEBUG__:
print('[Memory - free: {} allocated: {}]'.format(gc.mem_free(), gc.mem_alloc()))
print(f'[Memory - free: {gc.mem_free()} allocated: {gc.mem_alloc()}]')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SX127x.collect_garbage refactored with the following changes:

payload = lora.read_payload()
print(payload)
screen[0] = "pkt: {}".format(payload)
screen[0] = f"pkt: {payload}"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function receive refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant