MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / main

Function main

scripts/ragnar_swap_button.py:113–133  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

111
112
113def main():
114 gpio_ok = start_gpio_listener()
115 pisugar_ok = start_pisugar_listener()
116
117 if not gpio_ok and not pisugar_ok:
118 log.error("No input sources available (neither GPIO nor PiSugar). Exiting.")
119 sys.exit(1)
120
121 sources = []
122 if gpio_ok:
123 sources.append("GPIO KEY1")
124 if pisugar_ok:
125 sources.append("PiSugar button")
126 log.info(f"Listening for swap triggers: {', '.join(sources)}")
127
128 # Keep alive
129 try:
130 while True:
131 time.sleep(1)
132 except KeyboardInterrupt:
133 log.info("Stopped.")
134
135
136if __name__ == '__main__':

Callers 1

Calls 7

start_gpio_listenerFunction · 0.85
start_pisugar_listenerFunction · 0.85
errorMethod · 0.80
exitMethod · 0.80
appendMethod · 0.80
infoMethod · 0.80
sleepMethod · 0.45

Tested by

no test coverage detected