From 4d30ff776ceb2cdc5ef73f95b158a03021c096a5 Mon Sep 17 00:00:00 2001
From: Robert Koeppl <rkoeppl@gmx.at>
Date: Tue, 19 Apr 2016 01:33:13 +0200
Subject: [PATCH] configured and defined basic variables in
 configuration-module started to introduce primitive samity-checks and
 configuration evaluation to printengime untill further notice onyl Beaglebone
 black with Lightcrafter 4500 on HDMI will be supported.

---
 modules/printengine.cfg | 44 ++++++++++++++++++++++++++++++++++++++++-
 modules/printengine.pl  | 28 ++++++++++++++++++++++++--
 2 files changed, 69 insertions(+), 3 deletions(-)

diff --git a/modules/printengine.cfg b/modules/printengine.cfg
index fb479b1..5ef2ac1 100644
--- a/modules/printengine.cfg
+++ b/modules/printengine.cfg
@@ -1,7 +1,49 @@
+#!/usr/bin/perl
 #Configuration file for printengine.pl to be called by SLAcer.js and other printer services
 #Copyright 2016 Robert Koeppl, Fablab Leoben robert.koeppl@fablab-leoben.at
 #http://www.fablab-leoben.at
 #http://www.github.com/fablab-leoben
 #released under the MIT License
 #this piece of software is provided with absolutely no warranty
-#use at your own risk
\ No newline at end of file
+#use at your own risk
+my $log_file = "../log/printengine.log";
+my $logging_enabled="TRUE";
+my $controllerboard="BBB";
+my $steps_per_mm=100; #steps needed to move the Z-Axis 1mm
+my $projector_type="Lightcrafter4500"; #default Light engine
+my $projector_usb_device="";
+my $endstop_Z_max=TRUE;
+my $endstop_Z_max_type="NC";#NO="Normally Open", NC="Normally Closed". NC is preferred
+my $endstop_Z_min=TRUE;
+my $endstop_Z_min_type="NC";#NO="Normally Open", NC="Normally Closed". NC is preferred
+my $wiper="FALSE";
+my $door_contact="true"; Defines if there is a door contact to determine if the enclosure is closed
+my $X_pixels="1192";
+my $Y_pixels="948";
+my $Z_Autocal="True"; #Automatically determine Z-travel by triggering both endstops and dividing the Distance
+my $testrun_capable="true"; Capability to run testruns with wavelengthe that do not trigger polymerisation
+my $testrun_color="RED"; #Color channel used for test run
+my $prodrun_color="BLUE"; #Color Channel used for production run
+my $vat_heatable="false";
+my $check_vat_presence="false";
+#board specific configuration for Beaglebone Black
+if ($controllerboard eq "BBB") then {
+my $virtual_terminal=1;
+my $display_software="fbi";
+my $display_device="/dev/fb0";
+#PIN asignment
+my $pin_zmin="";
+my $pin_zmax="";
+my $pin_door="";
+my $pin_step_Z="";
+my $pin_enable_Z="";
+my $pin_direction_Z="";
+my $pin_trigger_pre="";
+my $pin_trigger_post="";
+my $pin_enable_wiper="";
+my $pin_dir_wiper="";
+my $pin_step_wiper="";
+my $pin_vat_heater="";
+my $pin_vat_temperature="";
+my $pin_vat_presence="";
+}
\ No newline at end of file
diff --git a/modules/printengine.pl b/modules/printengine.pl
index 5345496..8b69d54 100644
--- a/modules/printengine.pl
+++ b/modules/printengine.pl
@@ -1,9 +1,33 @@
 #!/usr/bin/perl
-#print engine to be called by SLAcer.js and other printer services
+#print engine to be called by SLAcer.js and other printer services orstandalone from command line
 #Copyright 2016 Robert Koeppl, Fablab Leoben robert.koeppl@fablab-leoben.at
 #http://www.fablab-leoben.at
 #http://www.github.com/fablab-leoben
 #released under the MIT License
 #this piece of software is provided with absolutely no warranty
 #use at your own risk
-#configuration is stored in printengine.cfg, do not use hardcoded configuration in ths per script, that is bad practice.
\ No newline at end of file
+#configuration is stored in printengine.cfg, do not use hardcoded configuration in ths per script, that is bad practice.
+use warning;
+use strict;
+use Getopt::Std;
+use Getopt::Long;
+use feature qw(say);
+
+#include configuration and settings from printengine.cfg
+use printengine.cfg
+#checked for used controller board type according to configuration.
+#activate logging to logfile
+if $logging_enabled eq "TRUE" then
+{
+open my $log_fh, ">", $log_file;
+}
+
+if $controllerboard eq "BBB" then 
+{
+
+}
+else {
+say "unknows printer type $controllerboard , please review your configuration, get in touch with developers or fork the code on Github and contribute the code to use the new printer"
+;
+die "unknown board in configuration!\n";
+}
\ No newline at end of file
