Skip to content

Commit 0f72bc7

Browse files
Add disable function to esp class (#141)
* add disable function * add mypy cache to syncignore * add completion output to enable, reset and disable * only use en to disable
1 parent a68b5bb commit 0f72bc7

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

.syncignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ __pycache__/
44
*.tmp
55
.env
66
.venv
7+
.mypy_cache
78

89
# Ignore everything in build except li*, bo* and pa*
910
build/[c-kC-K]*

esp.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,16 @@ def reset(self) -> None:
7272
self.write(f'{self.gpio_en}/value', self.on)
7373
sleep(0.5)
7474
self.write(f'{self.gpio_en}/value', self.off)
75+
print('reset complete')
7576

7677
def enable(self) -> None:
7778
print('Enabling microcontroller...')
7879
self.write(f'{self.gpio_g0}/value', self.off)
7980
sleep(0.5)
8081
self.write(f'{self.gpio_en}/value', self.off)
82+
print('enable complete')
83+
84+
def disable(self) -> None:
85+
print('Disabling microcontroller...')
86+
self.write(f'{self.gpio_en}/value', self.on)
87+
print('disable complete')

flash.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ def show_help() -> None:
4242
esp.enable()
4343
sys.exit()
4444

45+
if 'disable' in sys.argv:
46+
with esp.pin_config():
47+
print('Disabling ESP...')
48+
esp.disable()
49+
sys.exit()
50+
4551
if 'reset' in sys.argv:
4652
with esp.pin_config():
4753
print('Resetting ESP...')

0 commit comments

Comments
 (0)