Skip to content

Commit

Permalink
Delete the camera controller for the old raspimjpeg-based imager (#71)
Browse files Browse the repository at this point in the history
* Delete the camera controller for the old raspimjpeg-based imager

* Update `main.py` for adafruithat (forgotten in previous commit)

* Update subpackage name references
  • Loading branch information
ethanjli authored Dec 26, 2024
1 parent 517772f commit 8493ebe
Show file tree
Hide file tree
Showing 16 changed files with 128 additions and 2,921 deletions.
29 changes: 17 additions & 12 deletions control/adafruithat/main.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Copyright Romain Bazile and other PlanktoScope project contributors
#
#
# This file is part of the PlanktoScope software.
#
#
# PlanktoScope is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# PlanktoScope is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with PlanktoScope. If not, see <http://www.gnu.org/licenses/>.

Expand All @@ -25,13 +25,13 @@

import planktoscope.mqtt
import planktoscope.stepper
import planktoscope.light # Fan HAT LEDs
import planktoscope.light # Fan HAT LEDs
import planktoscope.identity
import planktoscope.uuidName # Note: this is deprecated.
import planktoscope.display # Fan HAT OLED screen
from planktoscope.imagernew import mqtt as imagernew
import planktoscope.uuidName # Note: this is deprecated.
import planktoscope.display # Fan HAT OLED screen
from planktoscope.imager import mqtt as imager

# enqueue=True is necessary so we can log accross modules
# enqueue=True is necessary so we can log across modules
# rotation happens everyday at 01:00 if not restarted
# TODO: ensure the log directory exists
logger.add(
Expand All @@ -58,6 +58,7 @@

run = True # global variable to enable clean shutdown from stop signals


def handler_stop_signals(signum, _):
"""This handler simply stop the forever running loop in __main__"""
global run
Expand All @@ -67,7 +68,9 @@ def handler_stop_signals(signum, _):

if __name__ == "__main__":
logger.info("Welcome!")
logger.info( "Initialising signals handling and sanitizing the directories (step 1/4)")
logger.info(
"Initialising signals handling and sanitizing the directories (step 1/4)"
)
signal.signal(signal.SIGINT, handler_stop_signals)
signal.signal(signal.SIGTERM, handler_stop_signals)

Expand All @@ -93,7 +96,9 @@ def handler_stop_signals(signum, _):
# create the path!
os.makedirs(img_path)

logger.info(f"This PlanktoScope's Raspberry Pi's serial number is {planktoscope.uuidName.getSerial()}")
logger.info(
f"This PlanktoScope's Raspberry Pi's serial number is {planktoscope.uuidName.getSerial()}"
)
logger.info(
f"This PlanktoScope's machine name is {planktoscope.identity.load_machine_name()}"
)
Expand All @@ -113,7 +118,7 @@ def handler_stop_signals(signum, _):
# Starts the imager control process
logger.info("Starting the imager control process (step 3/4)")
try:
imager_thread = imagernew.Worker(shutdown_event)
imager_thread = imager.Worker(shutdown_event)
except Exception as e:
logger.error(f"The imager control process could not be started: {e}")
imager_thread = None
Expand Down
Loading

0 comments on commit 8493ebe

Please sign in to comment.