Skip to content
Permalink
Browse files

sanity checks implemented for base configuration

  • Loading branch information...
rkoeppl committed May 2, 2016
1 parent 75889c7 commit 87c91d68d5b25c45f8b8c9b7c8d994b22e52f6b1
Showing with 159 additions and 45 deletions.
  1. +53 −38 modules/printengine.cfg
  2. +106 −7 modules/printengine.pl
@@ -5,44 +5,59 @@
#released under the MIT License
#this piece of software is provided with absolutely no warranty
#use at your own risk
log_file = "../log/printengine.log";
logging_enabled="TRUE";
controllerboard="BBB";
steps_per_mm=100; #steps needed to move the Z-Axis 1mm
projector_type="Lightcrafter4500"; #default Light engine
projector_usb_device="";
endstop_Z_max=TRUE;
endstop_Z_max_type="NC";#NO="Normally Open", NC="Normally Closed". NC is preferred
endstop_Z_min=TRUE;
endstop_Z_min_type="NC";#NO="Normally Open", NC="Normally Closed". NC is preferred
wiper="FALSE";
door_contact="true"; Defines if there is a door contact to determine if the enclosure is closed
X_pixels="1192";
Y_pixels="948";
Z_Autocal="True"; #Automatically determine Z-travel by triggering both endstops and dividing the Distance
testrun_capable="true"; Capability to run testruns with wavelengthe that do not trigger polymerisation
testrun_color="RED"; #Color channel used for test run
prodrun_color="BLUE"; #Color Channel used for production run
vat_heatable="false";
vat_target_temperature="";#Vat temperature in Celsius
check_vat_presence="false";
log_file = "../log/printengine.log"
logging_enabled="TRUE"
controllerboard="BBB"
steps_per_mm="100" #steps needed to move the Z-Axis 1mm
projector_type="Lightcrafter4500"
#default Light engine
projector_usb_device="/dev/ttyUSB0"
endstop_Z_max="TRUE"
endstop_Z_max_type="NC"
#NO="Normally Open", NC="Normally Closed". NC is preferred
endstop_Z_min="TRUE"
endstop_Z_min_type="NC"
#NO="Normally Open", NC="Normally Closed". NC is preferred
wiper="FALSE"
door_contact="TRUE"
#Defines if there is a door contact to determine if the enclosure is closed
X_pixels="1192"
Y_pixels="948"
Z_speed="1"
#mm/s
Z_max_speed="10"
#mm/s
Z_Autocal="True"
#Automatically determine Z-travel by triggering both endstops and dividing the Distance
testrun_capable="true"
#Capability to run testruns with wavelengthe that do not trigger polymerisation
testrun_color="RED"
#Color channel used for test run
prodrun_color="BLUE"
#Color Channel used for production run
vat_heatable="false"
vat_target_temperature=""
#Vat temperature in Celsius
check_vat_presence="false"
#board specific configuration for Beaglebone Black
virtual_terminal=1;
display_software="fbi";
display_device="/dev/fb0";
virtual_terminal="1"
display_software="fbi"
display_device="/dev/fb0"
#PIN asignment
pin_zmin="";
pin_zmax="";
pin_door="";
pin_step_Z="";
pin_enable_Z="";
pin_direction_Z="";
pin_trigger_pre="";
pin_trigger_post="";
pin_enable_wiper="";
pin_dir_wiper="";
pin_step_wiper="";
pin_vat_heater="";
pin_vat_temperature="";
pin_vat_presence="";
pin_zmin="testpin"
pin_zmax="testpin"
pin_wiper_min="testpin"
pin_wiper_max="testpin"
pin_door="testpin"
pin_step_Z="testpin"
pin_enable_Z="testpin"
pin_direction_Z="testpin"
pin_trigger_pre="testpin"
pin_trigger_post="testpin"
pin_enable_wiper="testpin"
pin_dir_wiper="testpin"
pin_step_wiper="testpin"
pin_vat_heater="testpin"
pin_vat_temperature="testpin"
pin_vat_presence="testpin"
#end of BBB specifics
@@ -14,7 +14,7 @@
use Getopt::Long;
use feature qw(say);
use Config::Simple;

use File::Which;

#import configuration from configuration file
our $cfg = new Config::Simple();
@@ -35,6 +35,8 @@
my $door_contact=$cfg->param("door_contact");
my $X_pixels=$cfg->param("X_pixels");
my $Y_pixels=$cfg->param("Y_pixels");
my $Z_speed=$cfg->param("Z_speed");
my $Z_max_speed=$cfg->param("Z_max_speed");
my $Z_Autocal=$cfg->param("Z_Autocal");
my $testrun_capable=$cfg->param("testrun_capable");
my $testrun_color=$cfg->param("testrun_color");
@@ -56,6 +58,8 @@
my $pin_enable_wiper=$cfg->param("pin_enable_wiper");
my $pin_dir_wiper=$cfg->param("pin_dir_wiper");
my $pin_step_wiper=$cfg->param("pin_step_wiper");
my $pin_wiper_max=$cfg->param("pin_wiper_max");
my $pin_wiper_min=$cfg->param("pin_wiper_min");
my $pin_vat_heater=$cfg->param("pin_vat_heater");
my $pin_vat_temperature=$cfg->param("pin_vat_temperature");
my $pin_vat_presence=$cfg->param("pin_vat_presence");
@@ -67,27 +71,122 @@
#activate logging to logfile
if ($logging_enabled eq "TRUE")
{
unless (defined $log_file and length $log_file){
die "logging enabled but no logfile defined\n";}
open my $log_fh, ">", $log_file;
}

#basic sanity checks to determine whether or not the configuration is complete and makes at least some sense
#check if the parameters and pins needed for the features enabled are configured
unless (defined $steps_per_mm and length $steps_per_mm){
die "No steps per mm for Z Axis defined\n";}
unless (defined $controllerboard and length $controllerboard){
die "No controllerboard defined\n";}
unless (defined $projector_type and length $projector_type){
die "No projector type defined\n";}
unless (defined $display_device and length $display_device){
die "No display device defined\n";}
unless (defined $X_pixels and length $X_pixels){
die "No pixels in X direction defined\n";}
unless (defined $Y_pixels and length $Y_pixels){
die "No pixels in Y direction defined\n";}
unless (defined $Z_speed and length $Z_speed){
die "No Z speed defined\n";}
unless (defined $Z_max_speed and length $Z_max_speed){
die "No Z max speed defined\n";}
unless (defined $prodrun_color and length $prodrun_color){
die "No production run color defined\n";}
if ($check_vat_presence eq "TRUE")
{
unless (defined $pin_vat_presence and length $pin_vat_presence )
{
die "Vat presence pin definition missing\n";}
}
if ($door_contact eq "TRUE")
{
unless (defined $pin_door and length $pin_door )
{
die "door pin not defined\n";}
}
if ($testrun_capable eq "TRUE")
{
unless (defined $testrun_color and length $testrun_color )
{
die "Z max endstops definition incomplete\n";}
}
if ($endstop_Z_max eq "TRUE")
{
unless (defined $endstop_Z_max_type and length $endstop_Z_max_type and
defined $pin_zmax and length $pin_zmax )
{
die "Z max endstops definition incomplete\n";}
}
if ($endstop_Z_min eq "TRUE")
{
unless (defined $endstop_Z_min_type and length $endstop_Z_min_type and
defined $pin_zmin and length $pin_zmin )
{
die "Z min endstops definition incomplete\n";}
}
if ($Z_Autocal eq "TRUE")
{
unless ($endstop_Z_max eq "TRUE" and $endstop_Z_min eq "TRUE" and
defined $endstop_Z_max_type and length $endstop_Z_max_type and
defined $pin_zmax and length $pin_zmax and
defined $endstop_Z_min_type and length $endstop_Z_min_type and
defined $pin_zmin and length $pin_zmin)
{
die "Z endstops definition incomplete for autotune of Z axis Length\n";}
}
if ($wiper eq "TRUE")
{
unless (defined $pin_enable_wiper and length $pin_enable_wiper and
defined $pin_step_wiper and length $pin_step_wiper and
defined $pin_dir_wiper and length $pin_dir_wiper and
defined $pin_zmin and length $pin_zmin and
defined $pin_wiper_max and length $pin_wiper_max and
defined $pin_wiper_min and length $pin_wiper_min
)
{
die "pin definition incomplete for wiper usage\n";}
}
if ($vat_heatable eq "TRUE")
{
unless (defined $vat_target_temperature and length $vat_target_temperature and
defined $pin_vat_heater and length $pin_vat_heater and
defined $pin_vat_temperature and length $pin_vat_temperature)
{
die "Vat temperature or heater parameters are configured incompletely\n";}
}

if ($controllerboard eq "BBB") #if the Board is set to be a Beagle Bone Black, we need to check if it actually is one
{
say "Beagle Bone Black selected, checking board type! - check command still missing";
unless (defined $pin_trigger_post and length $pin_trigger_post and defined $pin_trigger_pre and length $pin_trigger_pre){
die "trigger pin definition incomplete\n";}
}
else {
say "unknown controller 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";
}
if ($projector_type eq "Lightcrafter4500")
{
unless (defined $projector_usb_device and length $projector_usb_device){
die "No projector USB device defined\n";}
}
else {
say "unknown projector type $projector_type , 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 projector in configuration!\n";
}

if ($display_software eq "fbi") #ckeck for configured Software to send Pictures to the projector
{
open(whichfile,"which $display_software |") || die "Failed: $!\n"; #find path to the binary
while ( <whichfile> )
{
my $display_software_path=$!;
}
my $display_software_path= which "fbi";
unless (defined $display_software_path and length $display_software_path){
die "configured display software not found\n";}
unless (defined $display_software_path and length $display_software_path){
die "configured display software not found\n";}
}
else { #if the configured Display software matches none of the supported packages, die
say "unknows display software $display_software , please review your configuration, get in touch with developers or fork the code on Github and contribute the code to use the new printer"

0 comments on commit 87c91d6

Please sign in to comment.
You can’t perform that action at this time.