#!/usr/bin/env bash
#
# Build tests for DUE (Atmel SAM3X8E ARM Cortex-M3)
# exit on first failure
set -e
backup_ramps
restore_configs
opt_set MOTHERBOARD BOARD_RAMPS4DUE_EFB EXTENSIBLE_UI EXTUI_EXAMPLE
opt_enable S_CURVE_ACCELERATION EEPROM_SETTINGS GCODE_MACROS
opt_set E0_AUTO_FAN_PIN 8
opt_set EXTRUDER_AUTO_FAN_SPEED 100
exec_test $1 $2 "RAMPS4DUE_EFB with S_CURVE_ACCELERATION, EEPROM_SETTINGS, GCODE_MACROS"
opt_set MOTHERBOARD BOARD_RADDS
opt_enable USE_XMAX_PLUG USE_YMAX_PLUG BLTOUCH AUTO_BED_LEVELING_BILINEAR \
Z_TRIPLE_STEPPER_DRIVERS Z_TRIPLE_ENDSTOPS Z_STEPPER_AUTO_ALIGN ENDSTOPPULLUPS
opt_add Z2_MAX_ENDSTOP_INVERTING false
opt_add Z3_MAX_ENDSTOP_INVERTING false
pins_set ramps/RAMPS X_MAX_PIN -1
pins_set ramps/RAMPS Y_MAX_PIN -1
opt_add Z2_MAX_PIN 2
opt_add Z3_MAX_PIN 3
exec_test $1 $2 "RADDS with Z_TRIPLE_STEPPER_DRIVERS and Z_STEPPER_AUTO_ALIGN"
# Test SWITCHING_EXTRUDER
opt_set MOTHERBOARD BOARD_RAMPS4DUE_EEF
opt_set EXTRUDERS 2
opt_set NUM_SERVOS 1
opt_enable SWITCHING_EXTRUDER ULTIMAKERCONTROLLER BEEP_ON_FEEDRATE_CHANGE POWER_LOSS_RECOVERY
exec_test $1 $2 "RAMPS4DUE_EEF with SWITCHING_EXTRUDER, POWER_LOSS_RECOVERY"