#!/usr/bin/env bash
#
# Build tests for Adafruit Grand Central M4 (ATMEL ARM Cortex-M4)
#

# exit on first failure
set -e

#
# Build with the default configurations
#
restore_configs
opt_set MOTHERBOARD BOARD_AGCM4_RAMPS_144 SERIAL_PORT -1 \
        TEMP_SENSOR_0 11 TEMP_SENSOR_BED 11 \
        X_DRIVER_TYPE TMC2209 Y_DRIVER_TYPE TMC2209 Z_DRIVER_TYPE TMC2209 Z2_DRIVER_TYPE TMC2209 E0_DRIVER_TYPE TMC2209 \
        RESTORE_LEVELING_AFTER_G28 false \
        LCD_LANGUAGE it \
        SDCARD_CONNECTION LCD \
        HOMING_BUMP_MM '{ 0, 0, 0 }'
opt_enable ENDSTOP_INTERRUPTS_FEATURE S_CURVE_ACCELERATION BLTOUCH Z_MIN_PROBE_REPEATABILITY_TEST \
           FILAMENT_RUNOUT_SENSOR G26_MESH_VALIDATION MESH_EDIT_GFX_OVERLAY Z_SAFE_HOMING \
           EEPROM_SETTINGS NOZZLE_PARK_FEATURE SDSUPPORT SD_CHECK_AND_RETRY \
           REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER Z_STEPPER_AUTO_ALIGN ADAPTIVE_STEP_SMOOTHING \
           STATUS_MESSAGE_SCROLLING LCD_SET_PROGRESS_MANUALLY SHOW_REMAINING_TIME USE_M73_REMAINING_TIME \
           LONG_FILENAME_HOST_SUPPORT SCROLL_LONG_FILENAMES BABYSTEPPING DOUBLECLICK_FOR_Z_BABYSTEPPING \
           MOVE_Z_WHEN_IDLE BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY \
           LIN_ADVANCE ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE MONITOR_DRIVER_STATUS SENSORLESS_HOMING \
           SQUARE_WAVE_STEPPING TMC_DEBUG EXPERIMENTAL_SCURVE
exec_test $1 $2 "Build Grand Central M4 Default Configuration" "$3"

# clean up
restore_configs