Skip to content

Configuration

maehw edited this page Oct 24, 2022 · 33 revisions

Operating system

There are at least three ways:

  • Using a Raspberry Pi single board computer
  • Using your Linux machine (laptop, desktop, etc.)

Cross reference: Hardware#computers.

Fresh Raspberry Pi OS installation

  • Flash the OS image on an SD card and put it back into the Raspberry Pi (flashing can be done by using dd or another tool)
  • It's recommended to attach a keyboard, a mouse and a screen for the initial configuration
  • Boot the Raspberry Pi and follow the configuration guide (localization, resetting the password, WiFi, etc.) (if accidentally closed it can be re-run by calling sudo piwiz)
  • Install software updates
  • Optionally run raspi-config to adjust the configuration (e.g. change the hostname, enable SSH for remote access, etc.), reboot
  • You can clone the repository directly to the Raspberry Pi as described in README.md

Configuration files

Settings

  • /opt/.selfomat.type: has <box_type> as its contents (is read during run-time)
  • ./settings/: holds multiple JSON files
    • <box_type>.json:
      • setup-specific settings are stored in this JSON file; at startup the code tries to open the JSON file with where box_type is initialized to a hard-coded default value during compile-time but can be replaced by the contents of /opt/.selfomat.type (see above)
      • settings inside the file are: camera_type, has_flash, has_button, disable_watchdog, debug, button_port_name, image_dir , show_led_setup, force_image_dir_mountpoint, fullscreen.
        • You need to give a valid image_dir and specify whether it needs to be a mount point or not via force_image_dir_mountpoint (${HOME}/<USERNAME>/Pictures is a possibility).
    • please note that the ./settings files are copied to ./build/settings at build time and changes after a build/ before a new build do not apply inside of ./settings
  • inside ${HOME}/
    • .selfomat_settings.json:
      • settings: trigger_counter, storage_enabled, printer_enabled, template_enabled, flash_enabled, show_agreement, filter_choice, filter_gain, debug_log_enabled, autofocus_before_trigger, frontend_language_choice)
      • acessed by methods BoothLogic::readSettings() and BoothLogic::writeSettings()
      • BoothLogic::readSettings() tries to read settings from this file and otherwise (if the file does not exist) uses hard-coded default values
      • BoothLogic::writeSettings() tries to write this file
  • internationalization ("i18n") is controlled by the files in ./i18n
    • related: frontend_language_choice as set in .selfomat_settings.json (see above) set the frontend language
    • [de|en|fr]_frontend.json: language definition files (German/English/French) for the photo booth's screen UI
    • [de|en.json]: language definition files (German/English) for the browser accessible settings app

Example .selfomat_settings.json:

{
    "show_agreement": "false",
    "trigger_counter": "914",
    "storage_enabled": "true",
    "printer_enabled": "true",
    "template_enabled": "true",
    "flash_enabled": "false",
    "filter_gain": "0.89999997615814209",
    "filter_choice": "1",
    "debug_log_enabled": "false",
    "autofocus_before_trigger": "false",
    "frontend_language_choice": "1"
}

Templates

Templates basically provide an overlay over the photo printouts. The idea is that you can frame the picture or overlay the final picture with a company logo. In order to create a template, you simply need to create a PNG frame with a transparent region. The photo booth software will detect the transparent region and insert the image there. Note that the image will be scaled in such a way that it's not stretched but covers the whole area.

Example:

An empty template image can be found here (1864 x 1228 pixels).

There are currently four template files:

  • /.template.png (accessed by ImageProcessor::loadTemplateImage())
  • /.template_screen.png (accessed by ImageProcessor::updateTemplate() and BoothGui::reloadTemplate())
  • /.template_props.json (accessed by ImageProcessor::loadTemplateImage() and ImageProcessor::updateTemplate())
  • /.template_screen_props.json (accessed by ImageProcessor::updateTemplate() and BoothGui::reloadTemplate())

All 4 files will be created by the software as soon as a template is uploaded using the website. The two .png files are the images: /.template.png is the full resolution template, the template_screen.png is the template scaled down for the user interface. This allows faster rendering since we don't need to scale it later. The two _prop.json files contain the rectangle where the image needs to be inserted in pixel coordinates. Again there is a file for the final print file as well as for the low resolution screen preview.

Template properties JSON files

Covers both /.template_props.json and /.template_screen_props.json.

Expected properties: offset_x, offset_y, offset_w, offset_h

Web app

The self-o-mat software provides a configuration website via built-in web server. The web server uses port 9080, i.e. it can be accessed using the URL http://<IP>:9080 or http://localhost:9080 on the local machine.

webapp

The interface between the web server and the standalone photo booth application is Protocol Buffers (Protobuf) - a free and open-source cross-platform data format used to serialize structured data. The message definitions can be found in the file api.proto.

Settings changes made via the web server applied to the standalone photo booth application are applied instantly since the web server directly calls C++ functions. All settings are stored on photo booth power off.

There's a short description how to configure NGINX to forward HTTP requests from the network: https://github.com/xtech/self-o-mat/discussions/14#discussioncomment-2260732

Re-building: The web app is currently described in the context of the following discussion: https://github.com/xtech/self-o-mat/discussions/28

CUPS

CUPS (formerly an acronym for Common UNIX Printing System) is a modular printing system for Unix-like computer operating systems which allows a computer to act as a print server. It also provides a web interface. It can be accessed using the URL http://<IP>:631 or http://localhost:631 on the local machine.

cups

Note: Using the link "CUPS Printer Setup" from inside the web-app won't work for all setups as it currently assumes the fix static IP 192.168.4.1.

Tips and tricks, Q&A

  • I am running my own setup. Is there a way to automatically unmount the DSLR's SD card? (see also discussion #25)

    Typically there is no need to have an SD card inserted into your DSLR. However, using the command gio mount -s gphoto2 should do the trick.

  • Are the photos also stored on the self-o-mat? If so, where can I find them?

    This depends on your settings. The storage location is configured by setting the image_dir variable inside of ./settings/<box_type>.json accordingly. To enabled/disabled disabling storage use the web-app. The software changes and uses the setting variable storage_enabled inside of ${HOME}/.selfomat_settings.json in the background.

  • Can I enable/disable printing?

    Yes, the web-app interface provides a switch to enable/disable printing during runtime. The software changes and uses the setting variable printer_enable inside of ${HOME}/.selfomat_settings.json in the background.