@@ -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