Skip to content

Commit 235ead6

Browse files
committed
adjust
1 parent f949be5 commit 235ead6

File tree

2 files changed

+4
-37
lines changed

2 files changed

+4
-37
lines changed

main.py

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -117,34 +117,4 @@ def run(self):
117117
choose_season_thread.stop()
118118
ss_old = ''
119119
ss_new = 'spring'
120-
kill_python_scripts_by_name(target_scripts)
121-
122-
# if __name__ == '__main__':
123-
# onoff_pin = 7 # physical 26
124-
# GPIO.setmode(GPIO.BCM)
125-
# GPIO.setup(onoff_pin, GPIO.IN)
126-
# target_scripts = ['playsound.py', 'plant_classification', 'spring_sound.py', 'rainy_sound.py', 'winter_sound.py']
127-
# run_script('playsound.py')
128-
129-
# while True:
130-
# GPIO.wait_for_edge(onoff_pin, GPIO.RISING)
131-
# print("ON button pressed. Starting system...")
132-
# time.sleep(0.3)
133-
134-
# choose_season_thread = choose_season()
135-
# choose_season_thread.start()
136-
137-
# try:
138-
# while GPIO.input(onoff_pin) == GPIO.LOW:
139-
# voltages = read_v()
140-
# voltage_str = ' | '.join([f"CH{i}: {v:.2f} V" for i, v in enumerate(voltages)])
141-
# print("Voltages ->", voltage_str)
142-
# time.sleep(0.5)
143-
# except KeyboardInterrupt:
144-
# break
145-
146-
# print("OFF button pressed. Stopping system...")
147-
# choose_season_thread.stop()
148-
# ss_old = ''
149-
# ss_new = 'spring'
150-
# kill_python_scripts_by_name(target_scripts)
120+
kill_python_scripts_by_name(target_scripts)

playsound.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,9 @@ def __init__(self):
100100
self.last_volume = None # Track last set volume to avoid redundant commands
101101
def read_avg_voltage(self, channel=3, samples=10, delay=0.01):
102102
values = []
103-
for i in range(samples):
104-
if i < 0.05:
105-
continue
106-
else:
107-
values.append(AnalogIn(ads2, channel).voltage)
108-
time.sleep(delay)
103+
for _ in range(samples):
104+
values.append(AnalogIn(ads2, channel).voltage)
105+
time.sleep(delay)
109106
return sum(values) / len(values)
110107
def run(self):
111108
while True:

0 commit comments

Comments
 (0)