Added eggbot settings and some neopixel fun to the gquadratic

This commit is contained in:
Rob Giseburt
2016-10-27 09:52:59 -05:00
parent d905ef088b
commit efd9754552
6 changed files with 565 additions and 28 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ ifeq ("$(BASE_BOARD)","gquadratic")
CHIP_LOWERCASE = sams70n19
BOARD_PATH = ./board/gquadratic
SOURCE_DIRS += ${BOARD_PATH} device/step_dir_driver device/step_dir_hobbyservo
SOURCE_DIRS += ${BOARD_PATH} device/step_dir_driver device/step_dir_hobbyservo device/neopixel
PLATFORM_BASE = ${MOTATE_PATH}/platform/atmel_sam
include $(PLATFORM_BASE).mk
+68 -2
View File
@@ -37,7 +37,37 @@
#include "MotatePower.h"
//Motate::ClockOutputPin<Motate::kExternalClock1_PinNumber> external_clk_pin {16000000}; // 16MHz optimally
Motate::OutputPin<Motate::kExternalClock1_PinNumber> external_clk_pin {Motate::kStartLow};
//Motate::OutputPin<Motate::kExternalClock1_PinNumber> external_clk_pin {Motate::kStartLow};
#include "neopixel.h"
#include "canonical_machine.h"
namespace LEDs {
NeoPixel<Motate::kLED_RGBWPixelPinNumber, 15> rgbw_leds {NeoPixelOrder::GRB};
RGB_Color_t display_color[15] {
{0, 0, 0, 5},
{0, 0, 0, 5},
{0, 0, 0, 5},
{0, 0, 0, 5},
{0, 0, 0, 5},
{0, 0, 0, 5},
{0, 0, 0, 5},
{0, 0, 0, 5},
{0, 0, 0, 5},
{0, 0, 0, 5},
{0, 0, 0, 5},
{0, 0, 0, 5},
{0, 0, 0, 5},
{0, 0, 0, 5},
{0, 0, 0, 5},
};
bool alarm_red = false; // if we are in alarm, the tells us if we're going to red (pulsing)
bool shutdown_white = false; // if we are in shutdown, the tells us if we're going to red (pulsing)
cmMachineState last_see_machine_state;
float old_x_pos = 0.0;
}
/*
* hardware_init() - lowest level hardware init
@@ -46,7 +76,13 @@ Motate::OutputPin<Motate::kExternalClock1_PinNumber> external_clk_pin {Motate::k
void hardware_init()
{
board_hardware_init();
external_clk_pin = 0; // Force external clock to 0 for now.
// external_clk_pin = 0; // Force external clock to 0 for now.
for (uint8_t pixel = 0; pixel < LEDs::rgbw_leds.count; pixel++) {
LEDs::display_color[pixel].startTransition(100, 0, 0, 0);
LEDs::rgbw_leds.setPixel(pixel, LEDs::display_color[pixel]);
}
LEDs::rgbw_leds.update();
}
/*
@@ -55,6 +91,36 @@ void hardware_init()
stat_t hardware_periodic()
{
float x_pos = cm_get_work_position(ACTIVE_MODEL, AXIS_X);
if (fabs(LEDs::old_x_pos - x_pos) > 0.01) {
LEDs::old_x_pos = x_pos;
float led_pos = x_pos * ((float)(LEDs::rgbw_leds.count-1) / 40);
for (uint8_t pixel = 0; pixel < LEDs::rgbw_leds.count; pixel++) {
float value = fabs(led_pos - (float)pixel);
if (value < 1.001) {
value = 1.0 - value;
if (LEDs::display_color[pixel].red < value) {
LEDs::display_color[pixel].startTransition(10, value, value, value);
} else {
LEDs::display_color[pixel].startTransition(500, 0, 0, 0);
}
} else {
// LEDs::display_color[pixel].startTransition(500, 0, 0, 0);
}
// LEDs::display_color[pixel].startTransition(100, std::max(0.0f, std::min(40.0f, (float)(x_pos/40.0) )), 0, 0);
}
}
for (uint8_t pixel = 0; pixel < LEDs::rgbw_leds.count; pixel++) {
if (LEDs::display_color[pixel].update()) {
LEDs::rgbw_leds.setPixel(pixel, LEDs::display_color[pixel]);
}
}
LEDs::rgbw_leds.update();
return STAT_OK;
}
+7
View File
@@ -147,6 +147,13 @@ ifeq ("$(CONFIG)","WaterColorBotv2")
SETTINGS_FILE="settings_watercolorbot_v2.h"
endif
ifeq ("$(CONFIG)","EggBot")
ifeq ("$(BOARD)","NONE")
BOARD=gquadratic-b
endif
SETTINGS_FILE="settings_eggbot.h"
endif
include $(wildcard ./board/$(STAR).mk)
+46 -25
View File
@@ -215,6 +215,12 @@ struct RGB_Color_t : NeopixelColorTag {
float green;
float blue;
enum ColorFilter {
Set = 0,
Lighten,
Darken
};
const uint32_t _update_timeout_ms;
Motate::Timeout _update_timeout;
@@ -233,7 +239,18 @@ struct RGB_Color_t : NeopixelColorTag {
_update_timeout.set(0);
};
void startTransition(uint32_t milliseconds, float to_red, float to_green, float to_blue) {
void startTransition(uint32_t milliseconds, float to_red, float to_green, float to_blue, ColorFilter cf = Set) {
if (cf == Lighten) {
to_red = std::max(to_red, red);
to_green = std::max(to_green, green);
to_blue = std::max(to_blue, blue);
}
else if (cf == Darken) {
to_red = std::min(to_red, red);
to_green = std::min(to_green, green);
to_blue = std::min(to_blue, blue);
}
_transition_steps_left = 0.5 + (milliseconds / _update_timeout_ms);
float h = 1.0 / _transition_steps_left;
float h_2 = h * h;
@@ -418,6 +435,10 @@ struct NeoPixel {
};
void setPixel(uint8_t pixel, uint8_t red, uint8_t green, uint8_t blue, int16_t white = -1) {
uint8_t data_width = 32;
if (!_has_white) {
data_width = 24;
}
if (_has_white && (white == -1)) {
// Adjust all of the RGB to accomodate white
white = std::min(red, std::min(green, blue));
@@ -425,32 +446,32 @@ struct NeoPixel {
// green -= white;
// blue -= white;
}
_period_buffer[0 + 1 + _red_offset + (pixel * 32)] = (red & 0b10000000) ? led_ON : led_OFF;
_period_buffer[1 + 1 + _red_offset + (pixel * 32)] = (red & 0b01000000) ? led_ON : led_OFF;
_period_buffer[2 + 1 + _red_offset + (pixel * 32)] = (red & 0b00100000) ? led_ON : led_OFF;
_period_buffer[3 + 1 + _red_offset + (pixel * 32)] = (red & 0b00010000) ? led_ON : led_OFF;
_period_buffer[4 + 1 + _red_offset + (pixel * 32)] = (red & 0b00001000) ? led_ON : led_OFF;
_period_buffer[5 + 1 + _red_offset + (pixel * 32)] = (red & 0b00000100) ? led_ON : led_OFF;
_period_buffer[6 + 1 + _red_offset + (pixel * 32)] = (red & 0b00000010) ? led_ON : led_OFF;
_period_buffer[7 + 1 + _red_offset + (pixel * 32)] = (red & 0b00000001) ? led_ON : led_OFF;
_period_buffer[0 + 1 + _red_offset + (pixel * data_width)] = (red & 0b10000000) ? led_ON : led_OFF;
_period_buffer[1 + 1 + _red_offset + (pixel * data_width)] = (red & 0b01000000) ? led_ON : led_OFF;
_period_buffer[2 + 1 + _red_offset + (pixel * data_width)] = (red & 0b00100000) ? led_ON : led_OFF;
_period_buffer[3 + 1 + _red_offset + (pixel * data_width)] = (red & 0b00010000) ? led_ON : led_OFF;
_period_buffer[4 + 1 + _red_offset + (pixel * data_width)] = (red & 0b00001000) ? led_ON : led_OFF;
_period_buffer[5 + 1 + _red_offset + (pixel * data_width)] = (red & 0b00000100) ? led_ON : led_OFF;
_period_buffer[6 + 1 + _red_offset + (pixel * data_width)] = (red & 0b00000010) ? led_ON : led_OFF;
_period_buffer[7 + 1 + _red_offset + (pixel * data_width)] = (red & 0b00000001) ? led_ON : led_OFF;
_period_buffer[0 + 1 + _green_offset + (pixel * 32)] = (green & 0b10000000) ? led_ON : led_OFF;
_period_buffer[1 + 1 + _green_offset + (pixel * 32)] = (green & 0b01000000) ? led_ON : led_OFF;
_period_buffer[2 + 1 + _green_offset + (pixel * 32)] = (green & 0b00100000) ? led_ON : led_OFF;
_period_buffer[3 + 1 + _green_offset + (pixel * 32)] = (green & 0b00010000) ? led_ON : led_OFF;
_period_buffer[4 + 1 + _green_offset + (pixel * 32)] = (green & 0b00001000) ? led_ON : led_OFF;
_period_buffer[5 + 1 + _green_offset + (pixel * 32)] = (green & 0b00000100) ? led_ON : led_OFF;
_period_buffer[6 + 1 + _green_offset + (pixel * 32)] = (green & 0b00000010) ? led_ON : led_OFF;
_period_buffer[7 + 1 + _green_offset + (pixel * 32)] = (green & 0b00000001) ? led_ON : led_OFF;
_period_buffer[0 + 1 + _green_offset + (pixel * data_width)] = (green & 0b10000000) ? led_ON : led_OFF;
_period_buffer[1 + 1 + _green_offset + (pixel * data_width)] = (green & 0b01000000) ? led_ON : led_OFF;
_period_buffer[2 + 1 + _green_offset + (pixel * data_width)] = (green & 0b00100000) ? led_ON : led_OFF;
_period_buffer[3 + 1 + _green_offset + (pixel * data_width)] = (green & 0b00010000) ? led_ON : led_OFF;
_period_buffer[4 + 1 + _green_offset + (pixel * data_width)] = (green & 0b00001000) ? led_ON : led_OFF;
_period_buffer[5 + 1 + _green_offset + (pixel * data_width)] = (green & 0b00000100) ? led_ON : led_OFF;
_period_buffer[6 + 1 + _green_offset + (pixel * data_width)] = (green & 0b00000010) ? led_ON : led_OFF;
_period_buffer[7 + 1 + _green_offset + (pixel * data_width)] = (green & 0b00000001) ? led_ON : led_OFF;
_period_buffer[0 + 1 + _blue_offset + (pixel * 32)] = (blue & 0b10000000) ? led_ON : led_OFF;
_period_buffer[1 + 1 + _blue_offset + (pixel * 32)] = (blue & 0b01000000) ? led_ON : led_OFF;
_period_buffer[2 + 1 + _blue_offset + (pixel * 32)] = (blue & 0b00100000) ? led_ON : led_OFF;
_period_buffer[3 + 1 + _blue_offset + (pixel * 32)] = (blue & 0b00010000) ? led_ON : led_OFF;
_period_buffer[4 + 1 + _blue_offset + (pixel * 32)] = (blue & 0b00001000) ? led_ON : led_OFF;
_period_buffer[5 + 1 + _blue_offset + (pixel * 32)] = (blue & 0b00000100) ? led_ON : led_OFF;
_period_buffer[6 + 1 + _blue_offset + (pixel * 32)] = (blue & 0b00000010) ? led_ON : led_OFF;
_period_buffer[7 + 1 + _blue_offset + (pixel * 32)] = (blue & 0b00000001) ? led_ON : led_OFF;
_period_buffer[0 + 1 + _blue_offset + (pixel * data_width)] = (blue & 0b10000000) ? led_ON : led_OFF;
_period_buffer[1 + 1 + _blue_offset + (pixel * data_width)] = (blue & 0b01000000) ? led_ON : led_OFF;
_period_buffer[2 + 1 + _blue_offset + (pixel * data_width)] = (blue & 0b00100000) ? led_ON : led_OFF;
_period_buffer[3 + 1 + _blue_offset + (pixel * data_width)] = (blue & 0b00010000) ? led_ON : led_OFF;
_period_buffer[4 + 1 + _blue_offset + (pixel * data_width)] = (blue & 0b00001000) ? led_ON : led_OFF;
_period_buffer[5 + 1 + _blue_offset + (pixel * data_width)] = (blue & 0b00000100) ? led_ON : led_OFF;
_period_buffer[6 + 1 + _blue_offset + (pixel * data_width)] = (blue & 0b00000010) ? led_ON : led_OFF;
_period_buffer[7 + 1 + _blue_offset + (pixel * data_width)] = (blue & 0b00000001) ? led_ON : led_OFF;
if (_has_white) {
_period_buffer[0 + 1 + _white_offset + (pixel * 32)] = (white & 0b10000000) ? led_ON : led_OFF;
+42
View File
@@ -59,6 +59,7 @@
D4522DC91C45F41D0086AAE6 /* g2core_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = g2core_info.h; sourceTree = "<group>"; };
D457117B17053EFA00EA19A8 /* Makefile */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile; sourceTree = "<group>"; usesTabs = 1; xcLanguageSpecificationIdentifier = xcode.lang.sh; };
D4782AB21D9B5F9400B32136 /* settings_watercolorbot_v2.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = settings_watercolorbot_v2.h; sourceTree = "<group>"; };
D4782AB41D9E2FF300B32136 /* settings_eggbot.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = settings_eggbot.h; sourceTree = "<group>"; };
D47B744C1D4925B4004FAB53 /* device */ = {isa = PBXFileReference; lastKnownFileType = folder; path = device; sourceTree = "<group>"; };
D48F5A40172CB1F900D0E055 /* canonical_machine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = canonical_machine.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
D48F5A41172CB1F900D0E055 /* config_app.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = config_app.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
@@ -147,6 +148,7 @@
isa = PBXGroup;
children = (
D4AC39081C77C1F20098D685 /* settings_default.h */,
D4782AB41D9E2FF300B32136 /* settings_eggbot.h */,
D4782AB21D9B5F9400B32136 /* settings_watercolorbot_v2.h */,
D4AC39091C77C1F20098D685 /* settings_makeblock.h */,
D4AC390A1C77C1F20098D685 /* settings_othermill_test.h */,
@@ -307,6 +309,20 @@
passBuildSettingsInEnvironment = 1;
productName = g3_due;
};
D4782AB61D9E39EC00B32136 /* G2 EggBot */ = {
isa = PBXLegacyTarget;
buildArgumentsString = "$(ACTION) VERBOSE=1 COLOR=0 CONFIG=EggBot DEBUG=1";
buildConfigurationList = D4782AB71D9E39EC00B32136 /* Build configuration list for PBXLegacyTarget "G2 EggBot" */;
buildPhases = (
);
buildToolPath = /usr/bin/make;
buildWorkingDirectory = .;
dependencies = (
);
name = "G2 EggBot";
passBuildSettingsInEnvironment = 1;
productName = g3_due;
};
D4AC391A1C7BAB8E0098D685 /* G2 sbv300 */ = {
isa = PBXLegacyTarget;
buildArgumentsString = "$(ACTION) VERBOSE=1 COLOR=0 CONFIG=sbv300 DEBUG=2";
@@ -429,6 +445,7 @@
D43FF7141D537A5C00FB5B53 /* G2 gQuadratic Test */,
D4782AAE1D9B16BE00B32136 /* G2 Probotix */,
D457112317053BFB00EA19A8 /* index */,
D4782AB61D9E39EC00B32136 /* G2 EggBot */,
);
};
/* End PBXProject section */
@@ -686,6 +703,22 @@
};
name = Release;
};
D4782AB81D9E39EC00B32136 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
PATH = "$PATH:/usr/local/gcc-arm-none-eabi/bin";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
D4782AB91D9E39EC00B32136 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
PATH = "$PATH:/usr/local/gcc-arm-none-eabi/bin";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
D4AC391C1C7BAB8E0098D685 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -832,6 +865,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
D4782AB71D9E39EC00B32136 /* Build configuration list for PBXLegacyTarget "G2 EggBot" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D4782AB81D9E39EC00B32136 /* Debug */,
D4782AB91D9E39EC00B32136 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
D4AC391B1C7BAB8E0098D685 /* Build configuration list for PBXLegacyTarget "G2 sbv300" */ = {
isa = XCConfigurationList;
buildConfigurations = (
+401
View File
@@ -0,0 +1,401 @@
/*
* settings_eggbot.h - settings for the EggBot
* This file is part of the g2core project
*
* Copyright (c) 2016 Alden S. Hart Jr.
* Copyright (c) 2016 Robert Giseburt
*
* This file ("the software") is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2 as published by the
* Free Software Foundation. You should have received a copy of the GNU General Public
* License, version 2 along with the software. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, you may use this file as part of a software library without
* restriction. Specifically, if other files instantiate templates or use macros or
* inline functions from this file, or you compile this file and link it with other
* files to produce an executable, this file does not by itself cause the resulting
* executable to be covered by the GNU General Public License. This exception does not
* however invalidate any other reasons why the executable file might be covered by the
* GNU General Public License.
*
* THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY
* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
* SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/***********************************************************************/
/**** TestV9 profile - naked board *************************************/
/***********************************************************************/
// ***> NOTE: The init message must be a single line with no CRs or LFs
#define INIT_MESSAGE "Initializing configs to WaterColorBot v2 settings"
#define JUNCTION_INTEGRATION_TIME 1.50 // cornering - usually between 0.5 and 2.0 (higher is faster)
#define CHORDAL_TOLERANCE 0.01 // chordal accuracy for arc drawing (in mm)
#define SOFT_LIMIT_ENABLE 0 // 0=off, 1=on
#define HARD_LIMIT_ENABLE 1 // 0=off, 1=on
#define SAFETY_INTERLOCK_ENABLE 1 // 0=off, 1=on
#define SPINDLE_ENABLE_POLARITY 1 // 0=active low, 1=active high
#define SPINDLE_DIR_POLARITY 0 // 0=clockwise is low, 1=clockwise is high
#define SPINDLE_PAUSE_ON_HOLD true
#define SPINDLE_DWELL_TIME 1.0
#define COOLANT_MIST_POLARITY 1 // 0=active low, 1=active high
#define COOLANT_FLOOD_POLARITY 1 // 0=active low, 1=active high
#define COOLANT_PAUSE_ON_HOLD false
// Communications and reporting settings
#define COMM_MODE JSON_MODE // one of: TEXT_MODE, JSON_MODE
#define XIO_ENABLE_FLOW_CONTROL FLOW_CONTROL_RTS // FLOW_CONTROL_OFF, FLOW_CONTROL_RTS
#define TEXT_VERBOSITY TV_VERBOSE // one of: TV_SILENT, TV_VERBOSE
#define JSON_VERBOSITY JV_MESSAGES // one of: JV_SILENT, JV_FOOTER, JV_CONFIGS, JV_MESSAGES, JV_LINENUM, JV_VERBOSE
#define QUEUE_REPORT_VERBOSITY QR_OFF // one of: QR_OFF, QR_SINGLE, QR_TRIPLE
#define STATUS_REPORT_VERBOSITY SR_FILTERED // one of: SR_OFF, SR_FILTERED, SR_VERBOSE
#define STATUS_REPORT_MIN_MS 100 // milliseconds - enforces a viable minimum
#define STATUS_REPORT_INTERVAL_MS 250 // milliseconds - set $SV=0 to disable
//#define STATUS_REPORT_DEFAULTS "line","posx","posy","posz","posa","bcr","feed","vel","unit","coor","dist","admo","frmo","momo","stat"
#define STATUS_REPORT_DEFAULTS "line","posx","posy","posz","feed","vel","momo","stat"
// Alternate SRs
//#define STATUS_REPORT_DEFAULTS "line","vel","mpox","mpoy","mpoz","mpoa","coor","ofsa","ofsx","ofsy","ofsz","dist","unit","stat","homz","homy","homx","momo"
//#define STATUS_REPORT_DEFAULTS "_ts1","_cs1","_es1","_xs1","_fe1","line","posx","posy","posz","vel","stat"
//#define STATUS_REPORT_DEFAULTS "line","posx","posy","posz","vel","_cs1","_es1","_xs1","_fe1","_cs2","_es2","_xs2","_fe2"
//#define STATUS_REPORT_DEFAULTS "mpox","mpoy","mpoz","mpoa","ofsx","ofsy","ofsz","ofsa","unit","stat","coor","momo","dist","home","hold","macs","cycs","mots","plan","feed"
//#define STATUS_REPORT_DEFAULTS "line","mpox","mpoy","mpoz","mpoa","ofsx","ofsy","ofsz","ofsa","stat","_cs1","_es1","_fe0","_fe1","_fe2","_fe3"
//#define STATUS_REPORT_DEFAULTS "line","mpox","mpoy","mpoz","stat","_ts2","_ps2","_cs2","_es2","_fe2"
//#define STATUS_REPORT_DEFAULTS "line","mpox","mpoy","mpoz","_cs3","_es3","_fe3","_xs3","_cs2","_es2","_fe2","_xs2","stat"
//#define STATUS_REPORT_DEFAULTS "line","posx","posy","posz","posa","feed","vel","unit","coor","dist","frmo","momo","stat","_cs1","_es1","_xs1","_fe1"
// Gcode startup defaults
#define GCODE_DEFAULT_UNITS MILLIMETERS // MILLIMETERS or INCHES
#define GCODE_DEFAULT_PLANE CANON_PLANE_XY // CANON_PLANE_XY, CANON_PLANE_XZ, or CANON_PLANE_YZ
#define GCODE_DEFAULT_COORD_SYSTEM G54 // G54, G55, G56, G57, G58 or G59
#define GCODE_DEFAULT_PATH_CONTROL PATH_CONTINUOUS
#define GCODE_DEFAULT_DISTANCE_MODE ABSOLUTE_MODE
// *** motor settings ************************************************************************************
#define MOTOR_POWER_MODE MOTOR_POWERED_IN_CYCLE // default motor power mode (see cmMotorPowerMode in stepper.h)
#define MOTOR_POWER_TIMEOUT 2.00 // motor power timeout in seconds
#define MOTOR_POWER_MODE MOTOR_POWERED_IN_CYCLE // default motor power mode (see cmMotorPowerMode in stepper.h)
#define MOTOR_POWER_TIMEOUT 2.00 // motor power timeout in seconds
#define M1_MOTOR_MAP AXIS_Y // 1ma
#define M1_STEP_ANGLE 1.8 // 1sa
#define M1_TRAVEL_PER_REV 125.66370614 // 1tr
#define M1_MICROSTEPS 32 // 1mi 1,2,4,8
#define M1_POLARITY 1 // 1po 0=normal, 1=reversed
#define M1_POWER_MODE MOTOR_POWER_MODE // 1pm standard
#define M1_POWER_LEVEL 0.4
#define M2_MOTOR_MAP AXIS_X
#define M2_STEP_ANGLE 1.8
#define M2_TRAVEL_PER_REV 125.66370614
#define M2_MICROSTEPS 32
#define M2_POLARITY 1
#define M2_POWER_MODE MOTOR_POWER_MODE
#define M2_POWER_LEVEL 0.4
#define M3_MOTOR_MAP AXIS_Z
// This "stepper" is a hobby servo. Note that all hobby
// servo settings are per full servo range, instead of
// per revolution.
#define M3_STEP_ANGLE 1.8 // hobby servos are simulated with 200 "full steps"
#define M3_TRAVEL_PER_REV 26 // this is actually the full travel of the servo, not
// necessarily covering a revolution
#define M3_MICROSTEPS 32 // the max step resolution for a hobby servo is 1/32
#define M3_POLARITY 1
#define M3_POWER_MODE MOTOR_ALWAYS_POWERED
#define M3_POWER_LEVEL 0.50 // this is ignored
#define M4_MOTOR_MAP AXIS_A
#define M4_STEP_ANGLE 1.8
#define M4_TRAVEL_PER_REV 360 // degrees moved per motor rev
#define M4_MICROSTEPS 32
#define M4_POLARITY 0
#define M4_POWER_MODE MOTOR_POWER_MODE
#define M4_POWER_LEVEL 0.6
// *** axis settings **********************************************************************************
#define JERK_MAX 20000
#define X_AXIS_MODE AXIS_STANDARD // xam see canonical_machine.h cmAxisMode for valid values
#define X_VELOCITY_MAX 50000 // xvm G0 max velocity in mm/min
#define X_FEEDRATE_MAX X_VELOCITY_MAX // xfr G1 max feed rate in mm/min
#define X_TRAVEL_MIN 0 // xtn minimum travel - used by soft limits and homing
#define X_TRAVEL_MAX 400 // xtm maximum travel - used by soft limits and homing
#define X_JERK_MAX JERK_MAX // xjm
#define X_JERK_HIGH_SPEED X_JERK_MAX // xjh
#define X_HOMING_INPUT 1 // xhi input used for homing or 0 to disable
#define X_HOMING_DIRECTION 0 // xhd 0=search moves negative, 1= search moves positive
#define X_SEARCH_VELOCITY 1000 // xsv move in negative direction
#define X_LATCH_VELOCITY 100 // xlv mm/min
#define X_LATCH_BACKOFF 10 // xlb mm
#define X_ZERO_BACKOFF 2 // xzb mm
#define Y_AXIS_MODE AXIS_STANDARD
#define Y_VELOCITY_MAX 50000
#define Y_FEEDRATE_MAX Y_VELOCITY_MAX
#define Y_TRAVEL_MIN 0
#define Y_TRAVEL_MAX 175
#define Y_JERK_MAX JERK_MAX
#define Y_JERK_HIGH_SPEED Y_JERK_MAX
#define Y_HOMING_INPUT 3
#define Y_HOMING_DIRECTION 0
#define Y_SEARCH_VELOCITY 1000
#define Y_LATCH_VELOCITY 100
#define Y_LATCH_BACKOFF 10
#define Y_ZERO_BACKOFF 2
#define Z_AXIS_MODE AXIS_STANDARD
#define Z_VELOCITY_MAX 15000
#define Z_FEEDRATE_MAX Z_VELOCITY_MAX
#define Z_TRAVEL_MIN 0
#define Z_TRAVEL_MAX 75
#define Z_JERK_MAX 5000
#define Z_JERK_HIGH_SPEED Z_JERK_MAX
#define Z_HOMING_INPUT 6
#define Z_HOMING_DIRECTION 1
#define Z_SEARCH_VELOCITY 600
#define Z_LATCH_VELOCITY 100
#define Z_LATCH_BACKOFF 10
#define Z_ZERO_BACKOFF 2
// Rotary values are chosen to make the motor react the same as X for testing
/***************************************************************************************
* To calculate the speeds here, in Wolfram Alpha-speak:
*
* c=2*pi*r, r=0.609, d=c/360, s=((S*60)/d), S=40 for s
* c=2*pi*r, r=5.30516476972984, d=c/360, s=((S*60)/d), S=40 for s
*
* Change r to A_RADIUS, and S to the desired speed, in mm/s or mm/s/s/s.
*
* It will return s= as the value you want to enter.
*
* If the value is over 1 million, the code will divide it by 1 million,
* so you have to pre-multiply it by 1000000.0. (The value is in millions, btw.)
*
* Note that you need these to be floating point values, so always have a .0 at the end!
*
***************************************************************************************/
#define A_AXIS_MODE AXIS_RADIUS
#define A_RADIUS 5.30516476972984
//#define A_VELOCITY_MAX 25920.0 // ~40 mm/s, 2,400 mm/min
//#define A_FEEDRATE_MAX 25920.0/2.0 // ~20 mm/s, 1,200 mm/min
#define A_VELOCITY_MAX 77760.0 // G0 rate ~120 mm/s, 2,400 mm/min
#define A_FEEDRATE_MAX 9720.0 // 9720.0 = G1 rate ~15 mm/s, 900 mm/min
#define A_TRAVEL_MIN 0
#define A_TRAVEL_MAX 10
#define A_JERK_MAX 648000 // 1,000 million mm/min^3 = 648000
// * a million IF it's over a million
// c=2*pi*r, r=5.30516476972984, d=c/360, s=((1000*60)/d)
#define A_HOMING_INPUT 0
#define A_HOMING_DIRECTION 0
#define A_SEARCH_VELOCITY 2000
#define A_LATCH_VELOCITY 2000
#define A_LATCH_BACKOFF 5
#define A_ZERO_BACKOFF 2
#define A_JERK_HIGH_SPEED A_JERK_MAX
#define B_AXIS_MODE AXIS_DISABLED
#define B_RADIUS 1
#define B_VELOCITY_MAX 3600
#define B_FEEDRATE_MAX B_VELOCITY_MAX
#define B_TRAVEL_MIN 0
#define B_TRAVEL_MAX -1
//#define B_JERK_MAX 20000000
#define B_JERK_MAX 20
#define B_HOMING_INPUT 0
#define B_HOMING_DIRECTION 0
#define B_SEARCH_VELOCITY 600
#define B_LATCH_VELOCITY 100
#define B_LATCH_BACKOFF 10
#define B_ZERO_BACKOFF 2
#define B_JERK_HIGH_SPEED A_JERK_MAX
//*** Input / output settings ***
/*
IO_MODE_DISABLED
IO_ACTIVE_LOW aka NORMALLY_OPEN
IO_ACTIVE_HIGH aka NORMALLY_CLOSED
INPUT_ACTION_NONE
INPUT_ACTION_STOP
INPUT_ACTION_FAST_STOP
INPUT_ACTION_HALT
INPUT_ACTION_RESET
INPUT_FUNCTION_NONE
INPUT_FUNCTION_LIMIT
INPUT_FUNCTION_INTERLOCK
INPUT_FUNCTION_SHUTDOWN
INPUT_FUNCTION_PANIC
*/
// Inputs are defined for the g2ref(a) board
// Xmn (board label)
#define DI1_MODE IO_ACTIVE_HIGH
#define DI1_ACTION INPUT_ACTION_NONE
#define DI1_FUNCTION INPUT_FUNCTION_NONE
// Xmax
#define DI2_MODE IO_MODE_DISABLED
#define DI2_ACTION INPUT_ACTION_NONE
#define DI2_FUNCTION INPUT_FUNCTION_NONE
// Ymin
#define DI3_MODE IO_MODE_DISABLED
#define DI3_ACTION INPUT_ACTION_NONE
#define DI3_FUNCTION INPUT_FUNCTION_NONE
// Ymax
#define DI4_MODE IO_ACTIVE_HIGH
#define DI4_ACTION INPUT_ACTION_NONE
#define DI4_FUNCTION INPUT_FUNCTION_NONE
// Zmin
#define DI5_MODE IO_ACTIVE_LOW // Z probe
#define DI5_ACTION INPUT_ACTION_NONE
#define DI5_FUNCTION INPUT_FUNCTION_NONE
// Zmax
#define DI6_MODE IO_MODE_DISABLED
#define DI6_ACTION INPUT_ACTION_STOP
#define DI6_FUNCTION INPUT_FUNCTION_NONE
// Shutdown (Amin on v9 board)
#define DI7_MODE IO_MODE_DISABLED
#define DI7_ACTION INPUT_ACTION_NONE
#define DI7_FUNCTION INPUT_FUNCTION_NONE
// High Voltage Z Probe In (Amax on v9 board)
#define DI8_MODE IO_ACTIVE_LOW
#define DI8_ACTION INPUT_ACTION_NONE
#define DI8_FUNCTION INPUT_FUNCTION_NONE
// Hardware interlock input
#define DI9_MODE IO_MODE_DISABLED
#define DI9_ACTION INPUT_ACTION_NONE
#define DI9_FUNCTION INPUT_FUNCTION_NONE
//Extruder1_PWM
#define DO1_MODE IO_ACTIVE_HIGH
//Extruder2_PWM
#define DO2_MODE IO_ACTIVE_HIGH
//Fan1A_PWM
#define DO3_MODE IO_ACTIVE_HIGH
//Fan1B_PWM
#define DO4_MODE IO_ACTIVE_HIGH
#define DO5_MODE IO_ACTIVE_HIGH
#define DO6_MODE IO_ACTIVE_HIGH
#define DO7_MODE IO_ACTIVE_HIGH
#define DO8_MODE IO_ACTIVE_HIGH
//SAFEin (Output) signal
#define DO9_MODE IO_ACTIVE_HIGH
#define DO10_MODE IO_ACTIVE_HIGH
//Header Bed FET
#define DO11_MODE IO_ACTIVE_HIGH
//Indicator_LED
#define DO12_MODE IO_ACTIVE_HIGH
#define DO13_MODE IO_ACTIVE_HIGH
/*** Extruders / Heaters ***/
/*
#define MIN_FAN_TEMP 40.0
#define MAX_FAN_TEMP 150.0
#define H1_DEFAULT_ENABLE true
#define H1_DEFAULT_P 9.0
#define H1_DEFAULT_I 0.12
#define H1_DEFAULT_D 400.0
#define H2_DEFAULT_ENABLE false
#define H2_DEFAULT_P 9.0
#define H2_DEFAULT_I 0.12
#define H2_DEFAULT_D 400.0
#define H3_DEFAULT_ENABLE false
#define H3_DEFAULT_P 9.0
#define H3_DEFAULT_I 0.12
#define H3_DEFAULT_D 400.0
*/
// *** PWM SPINDLE CONTROL ***
#define P1_PWM_FREQUENCY 100 // in Hz
#define P1_CW_SPEED_LO 1000 // in RPM (arbitrary units)
#define P1_CW_SPEED_HI 2000
#define P1_CW_PHASE_LO 0.125 // phase [0..1]
#define P1_CW_PHASE_HI 0.2
#define P1_CCW_SPEED_LO 1000
#define P1_CCW_SPEED_HI 2000
#define P1_CCW_PHASE_LO 0.125
#define P1_CCW_PHASE_HI 0.2
#define P1_PWM_PHASE_OFF 0.1
// *** DEFAULT COORDINATE SYSTEM OFFSETS ***
#define G54_X_OFFSET 0 // G54 is traditionally set to all zeros
#define G54_Y_OFFSET 0
#define G54_Z_OFFSET 0
#define G54_A_OFFSET 0
#define G54_B_OFFSET 0
#define G54_C_OFFSET 0
#define G55_X_OFFSET (X_TRAVEL_MAX/2) // set to middle of table
#define G55_Y_OFFSET (Y_TRAVEL_MAX/2)
#define G55_Z_OFFSET 0
#define G55_A_OFFSET 0
#define G55_B_OFFSET 0
#define G55_C_OFFSET 0
#define G56_X_OFFSET 0
#define G56_Y_OFFSET 0
#define G56_Z_OFFSET 0
#define G56_A_OFFSET 0
#define G56_B_OFFSET 0
#define G56_C_OFFSET 0
#define G57_X_OFFSET 0
#define G57_Y_OFFSET 0
#define G57_Z_OFFSET 0
#define G57_A_OFFSET 0
#define G57_B_OFFSET 0
#define G57_C_OFFSET 0
#define G58_X_OFFSET 0
#define G58_Y_OFFSET 0
#define G58_Z_OFFSET 0
#define G58_A_OFFSET 0
#define G58_B_OFFSET 0
#define G58_C_OFFSET 0
#define G59_X_OFFSET 0
#define G59_Y_OFFSET 0
#define G59_Z_OFFSET 0
#define G59_A_OFFSET 0
#define G59_B_OFFSET 0
#define G59_C_OFFSET 0