Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
31171ba
* Turning off PSU toggle on lack of toolhead reset confirmation!
phooky Nov 8, 2010
20e602d
* Multitool support
phooky Nov 8, 2010
aeeba97
bugfixes: uninitialized index variable
kintel Nov 10, 2010
0b8bcc5
Fix for external stepper extruder not stopping on reset or stop.
Nov 17, 2010
922a9e1
* Bumping version no., adding bootloader to dist dir
phooky Nov 8, 2010
5400518
* Commented out LCD hello world
phooky Nov 15, 2010
c86be06
* Adding production images for new extruder controller
phooky Nov 15, 2010
d8a04b3
* Added batch files for production
phooky Nov 15, 2010
2a9d787
Let the HOST_CMD_ENABLE_AXES support up to 5 axes
kintel Nov 15, 2010
c8e9b42
Support optiboot and bootloader-less operation.
Nov 17, 2010
86ad2b4
And, fix the fix.
Nov 17, 2010
eefe3eb
Fix for external stepper extruder not stopping on reset or stop.
Nov 17, 2010
4343483
And, fix the fix.
Nov 17, 2010
289aed1
Added support for specifying VERSION and BUILD_NAME when building fir…
kintel Nov 17, 2010
7a91517
Implemented SLAVE_CMD_IS_PLATFORM_READY and HOST_CMD_WAIT_FOR_PLATFORM
kintel Nov 17, 2010
3e3c7ed
Convenience scripts for creating date-tagged beta releases
kintel Nov 17, 2010
5e3d99c
* Added support for wait-for-tool timeouts
phooky Nov 18, 2010
4ff795f
bugfix: Timeout expects microsecs, not millisecs
kintel Nov 18, 2010
82f11bc
* update 3.4 board to handle 2.3 stepper hooks (unimplemented stubs)
phooky Nov 18, 2010
2b4d456
cosmetics
kintel Nov 22, 2010
fcf60d9
Fix for external steppers so they hold torque on M103 commands. To re…
kintel Nov 23, 2010
b424a9c
Set back default to be DC extruder
kintel Nov 23, 2010
a394851
Upped speed of Gen 4 to 115200 bps
kintel Nov 24, 2010
af6507f
* Changed to our Pin() idiom.
phooky Nov 19, 2010
b8992ee
* Added default axis inversions to support the ordinary Thingomatic c…
phooky Nov 30, 2010
1998832
* Remove xy inversions
phooky Nov 30, 2010
a29a9de
Simplifying MBMBv2.4 naming (now just mb24)
phooky Dec 1, 2010
36d07da
Merge remote branch 'origin/master'
Dec 2, 2010
2547d5a
Merge remote-tracking branch 'origin/master'
giseburt Sep 2, 2011
c1ebdab
Merge remote-tracking branch 'origin/master'
giseburt Oct 3, 2011
7c9d657
Merge remote-tracking branch 'origin/master'
giseburt Nov 7, 2011
f5abb9d
Fix case where bounce detection would make things worse.
giseburt Oct 6, 2011
de93df7
Merge branch 'master' of git://github.com/makerbot/G3Firmware
giseburt Nov 9, 2011
59ef0f1
Updated SConstruct/SConscript files to handle 5d-shield add-ons better.
giseburt Nov 9, 2011
6337f88
A good start toward acceleration, again.
giseburt Dec 14, 2011
a374b4e
Thrashing, please ignore.
giseburt Dec 16, 2011
a5ccf31
Damn bit-shifts, can't be negative!
giseburt Dec 22, 2011
eb6ca92
Got the circular buffer working, now to get the planner ironed out...
giseburt Dec 29, 2011
3c8bff0
Really really close...
giseburt Dec 29, 2011
8fd076f
A bunch more sorted out, but still a ways to go.
giseburt Jan 5, 2012
7a69996
Starting prep for new style.

giseburt Jan 5, 2012
6c64b5c
Grrr
giseburt Jan 12, 2012
dcb66ef
Moving, again.
giseburt Jan 12, 2012
cca5b52
Adding (stub) support for latest avr-libc changes.
giseburt Jan 12, 2012
605e9e6
Five axes, even for four steppers!
giseburt Jan 12, 2012
434a9cb
Working, except the planner isn't doing lookahead properly.
giseburt Jan 13, 2012
1ab512d
Working.
giseburt Jan 14, 2012
1b9661a
Fixing start/stop speed stupidity. Working on acceleration curve.
giseburt Jan 21, 2012
753f009
Fixed acceleration curve. Broke junction-jerk calks.
giseburt Feb 4, 2012
ba6cc00
Made the centripetal calculations optional, and not the default.
giseburt Feb 5, 2012
33a8bf3
Moving the planner "flags" to a single flags variable.
giseburt Feb 5, 2012
71d62f6
Now simulating dynamic micro step switching to free up CPU.
giseburt Feb 5, 2012
ec9a8d0
Fixed various planner bugs.
giseburt Feb 6, 2012
d6bf0d8
Optimizing for speed.
giseburt Feb 9, 2012
4c98d0b
More optimizing. Added hack to set min segment size.
giseburt Feb 9, 2012
fb25456
Changed the stepper tick timing to slower (256ms).
giseburt Feb 9, 2012
c784684
Cleaned up the 4/5 axis thing some more.
giseburt Feb 10, 2012
aa7e4ec
Trying to figure out the Z-Axis overrun.
giseburt Feb 10, 2012
2566ac0
Fixed arithmetic overflow errors with the Z axis.
giseburt Feb 10, 2012
ecc7170
Can now update plan of currently executing segment.
giseburt Feb 11, 2012
3235ddc
Set initial feedrate to 10, and fixed feedrate math.
giseburt Feb 11, 2012
7418f9e
Fixed first-movevment-after-startup-not-working bug.
giseburt Feb 12, 2012
c8da14f
Fixed some errors with overflow correction.
giseburt Feb 12, 2012
26c3965
Now, it's usable.
giseburt Feb 12, 2012
eb38335
Eeprom cleanup, and Gen4 support.
giseburt Feb 17, 2012
ba3bbe6
Final changes for acceleration.
giseburt Feb 18, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions firmware/SConstruct
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
platform = ARGUMENTS.get('platform','mb24')
fived = ARGUMENTS.get('fived','false')

if (platform == 'rrmbv12' or platform == 'mb24' or platform == 'mb24-2560'):
if (fived == 'true'):
platform = platform+'-5d'

SConscript(['src/SConscript.motherboard'], variant_dir='build/'+platform)

elif (platform == 'ecv22' or platform == 'ecv34'):
Expand Down
34 changes: 13 additions & 21 deletions firmware/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,27 @@

SCONS=SConstruct

PLATFORMS=( rrmbv12 mb24 mb24-2560 ecv22 ecv34 )
PLATFORMS=( rrmbv12 'rrmbv12 fived=true' mb24 mb24-2560 ecv22 ecv34 )

LOG_FILE=build_all_output


function build_firmware {
platform_list_name="$1[*]"
platform_list=(${!platform_list_name})
scons_file=$2

for platform in ${platform_list[@]}
for platform in "${PLATFORMS[@]}"
do
echo -n "Building firmware for ${platform}... "

echo -e "\n\n\n\n" >> ${LOG_FILE}
echo Building firmware for ${platform} >> ${LOG_FILE}

scons -f ${scons_file} platform=${platform} >> ${LOG_FILE} 2>&1
echo -n "Building firmware for ${platform}... "

if [ "$?" -ne "0" ]; then
echo Failure
else
echo Success
fi
done
echo -e "\n\n\n\n" >> ${LOG_FILE}
echo Building firmware for ${platform} >> ${LOG_FILE}

scons -f "${SCONS}" platform=${platform} >> ${LOG_FILE} 2>&1

if [ "$?" -ne "0" ]; then
echo Failure
else
echo Success
fi
done
}


Expand All @@ -51,8 +45,6 @@ function build_documentation {
echo Building all firmware
echo "Building all firmware" > ${LOG_FILE}

build_firmware PLATFORMS ${SCONS}


build_firmware

build_documentation
2 changes: 1 addition & 1 deletion firmware/current_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1
3.2
100 changes: 63 additions & 37 deletions firmware/src/Motherboard/Command.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "Command.hh"
#include "Steppers.hh"
#include "Planner.hh"
#include "Commands.hh"
#include "Tool.hh"
#include "Configuration.hh"
Expand All @@ -29,7 +30,8 @@

namespace command {

#define COMMAND_BUFFER_SIZE 512

#define COMMAND_BUFFER_SIZE 512 // Must be 2^N: 256, 512, 1204, etc
uint8_t buffer_data[COMMAND_BUFFER_SIZE];
CircularBuffer command_buffer(COMMAND_BUFFER_SIZE, buffer_data);

Expand Down Expand Up @@ -111,6 +113,44 @@ void reset() {
mode = READY;
}

// Handle movement comands -- called from a few places
static void handleMovementCommand(const uint8_t &command) {
// if we're already moving, check to make sure the buffer isn't full
if (mode == MOVING && planner::isBufferFull()) {
return; // we'll be back!
}
if (command == HOST_CMD_QUEUE_POINT_EXT) {
// check for completion
if (command_buffer.getLength() >= 25) {
command_buffer.pop(); // remove the command code
mode = MOVING;
int32_t x = pop32();
int32_t y = pop32();
int32_t z = pop32();
int32_t a = pop32();
int32_t b = pop32();
int32_t dda = pop32();
planner::addMoveToBuffer(Point(x,y,z,a,b), dda);
}
}
else if (command == HOST_CMD_QUEUE_POINT_NEW) {
// check for completion
if (command_buffer.getLength() >= 26) {
command_buffer.pop(); // remove the command code
mode = MOVING;
int32_t x = pop32();
int32_t y = pop32();
int32_t z = pop32();
int32_t a = pop32();
int32_t b = pop32();
int32_t us = pop32();
uint8_t relative = pop8();
planner::addMoveToBufferRelative(Point(x,y,z,a,b), us, relative);
}
}

}

// A fast slice for processing commands and refilling the stepper queue, etc.
void runCommandSlice() {
if (sdcard::isPlaying()) {
Expand All @@ -123,12 +163,21 @@ void runCommandSlice() {
if (!steppers::isRunning()) {
mode = READY;
} else if (homing_timeout.hasElapsed()) {
steppers::abort();
planner::abort();
mode = READY;
}
}
if (mode == MOVING) {
if (!steppers::isRunning()) { mode = READY; }
if (!steppers::isRunning()) {
mode = READY;
} else {
if (command_buffer.getLength() > 0) {
uint8_t command = command_buffer[0];
if (command == HOST_CMD_QUEUE_POINT_EXT || command == HOST_CMD_QUEUE_POINT_NEW) {
handleMovementCommand(command);
}
}
}
}
if (mode == DELAY) {
// check timers
Expand Down Expand Up @@ -185,48 +234,24 @@ void runCommandSlice() {
// process next command on the queue.
if (command_buffer.getLength() > 0) {
uint8_t command = command_buffer[0];

if (command == HOST_CMD_QUEUE_POINT_ABS) {
// check for completion
if (command_buffer.getLength() >= 17) {
// No longer supported, but we clear it off of the buffer to avoid a inifinite loop
command_buffer.pop(); // remove the command code
mode = MOVING;
int32_t x = pop32();
int32_t y = pop32();
int32_t z = pop32();
int32_t dda = pop32();
steppers::setTarget(Point(x,y,z),dda);
}
} else if (command == HOST_CMD_QUEUE_POINT_EXT) {
// check for completion
if (command_buffer.getLength() >= 25) {
command_buffer.pop(); // remove the command code
mode = MOVING;
int32_t x = pop32();
int32_t y = pop32();
int32_t z = pop32();
int32_t a = pop32();
int32_t b = pop32();
int32_t dda = pop32();
steppers::setTarget(Point(x,y,z,a,b),dda);
}
} else if (command == HOST_CMD_QUEUE_POINT_NEW) {
// check for completion
if (command_buffer.getLength() >= 26) {
command_buffer.pop(); // remove the command code
mode = MOVING;
int32_t x = pop32();
int32_t y = pop32();
int32_t z = pop32();
int32_t a = pop32();
int32_t b = pop32();
int32_t us = pop32();
uint8_t relative = pop8();
steppers::setTargetNew(Point(x,y,z,a,b),us,relative);
// steppers::setTarget(Point(x,y,z),dda);
}
} else if (command == HOST_CMD_QUEUE_POINT_EXT || command == HOST_CMD_QUEUE_POINT_NEW) {
handleMovementCommand(command);
} else if (command == HOST_CMD_CHANGE_TOOL) {
if (command_buffer.getLength() >= 2) {
command_buffer.pop(); // remove the command code
tool::setCurrentToolheadIndex(command_buffer.pop());
tool::setCurrentToolheadIndex(command_buffer.pop());
}
} else if (command == HOST_CMD_ENABLE_AXES) {
if (command_buffer.getLength() >= 2) {
Expand All @@ -246,7 +271,7 @@ void runCommandSlice() {
int32_t x = pop32();
int32_t y = pop32();
int32_t z = pop32();
steppers::definePosition(Point(x,y,z));
planner::definePosition(Point(x,y,z));
}
} else if (command == HOST_CMD_SET_POSITION_EXT) {
// check for completion
Expand All @@ -257,7 +282,7 @@ void runCommandSlice() {
int32_t z = pop32();
int32_t a = pop32();
int32_t b = pop32();
steppers::definePosition(Point(x,y,z,a,b));
planner::definePosition(Point(x,y,z,a,b));
}
} else if (command == HOST_CMD_DELAY) {
if (command_buffer.getLength() >= 5) {
Expand Down Expand Up @@ -291,7 +316,7 @@ void runCommandSlice() {
tool_wait_timeout.start(toolTimeout*1000000L);
}
} else if (command == HOST_CMD_WAIT_FOR_PLATFORM) {
// FIXME: Almost equivalent to WAIT_FOR_TOOL
// FIXME: Almost equivalent to WAIT_FOR_TOOL
if (command_buffer.getLength() >= 6) {
mode = WAIT_ON_PLATFORM;
command_buffer.pop();
Expand Down Expand Up @@ -336,7 +361,7 @@ void runCommandSlice() {
}
}

steppers::definePosition(newPoint);
planner::definePosition(newPoint);
}

} else if (command == HOST_CMD_TOOL_COMMAND) {
Expand All @@ -363,6 +388,7 @@ void runCommandSlice() {
}
} else {
}
} else { // command buffer is empty
}
}
}
Expand Down
36 changes: 27 additions & 9 deletions firmware/src/Motherboard/EepromMap.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,50 @@

namespace eeprom {

const static uint16_t EEPROM_SIZE = 0x0200;
const static uint16_t EEPROM_SIZE = 0x0200;

/// Version, low byte: 1 byte
const static uint16_t VERSION_LOW = 0x0000;
const static uint16_t VERSION_LOW = 0x0000;
/// Version, high byte: 1 byte
const static uint16_t VERSION_HIGH = 0x0001;
const static uint16_t VERSION_HIGH = 0x0001;

/// Axis inversion flags: 1 byte.
/// Axis N (where X=0, Y=1, etc.) is inverted if the Nth bit is set.
/// Axis N (where X = 0, Y=1, etc.) is inverted if the Nth bit is set.
/// Bit 7 is used for HoldZ OFF: 1 = off, 0 = on
const static uint16_t AXIS_INVERSION = 0x0002;
const static uint16_t AXIS_INVERSION = 0x0002;

/// Endstop inversion flags: 1 byte.
/// The endstops for axis N (where X=0, Y=1, etc.) are considered
/// The endstops for axis N (where X = 0, Y=1, etc.) are considered
/// to be logically inverted if the Nth bit is set.
/// Bit 7 is set to indicate endstops are present; it is zero to indicate
/// that endstops are not present.
/// Ordinary endstops (H21LOB et. al.) are inverted.
const static uint16_t ENDSTOP_INVERSION = 0x0003;
const static uint16_t ENDSTOP_INVERSION = 0x0003;

/// Name of this machine: 32 bytes.
const static uint16_t MACHINE_NAME = 0x0020;
const static uint16_t MACHINE_NAME = 0x0020;

/// Default locations for the axis: 5 x 32 bit = 20 bytes
const static uint16_t AXIS_HOME_POSITIONS = 0x0060;
const static uint16_t AXIS_HOME_POSITIONS = 0x0060;

/// Default steps/mm for each axis: 32 bits = 4 bytes
const static uint16_t ESTOP_CONFIG = 0x0074; // .. 0x0077

/// Default steps/mm for each axis: 5 x 32 bit = 20 bytes
const static uint16_t STEPS_PER_MM = 0x0078; // .. 0x008B

/// Master acceleration rate for each axis: 32 bits = 4 bytes
const static uint16_t MASTER_ACCELERATION_RATE = 0x008C; // .. 0x008F

/// Default acceleration rates for each axis: 5 x 32 bit = 20 bytes
const static uint16_t AXIS_ACCELERATION_RATES = 0x0090; // .. 0x00A3

/// Default acceleration rates for each axis: 4 x 32 bit = 16 bytes
/// X+Y have an integrated value, and Z, A, and B have their own values.
const static uint16_t AXIS_JUNCTION_JERK = 0x00A4; // .. 0x00B3

/// Default minimum planner speed: 32 bits = 1 byte
const static uint16_t MINIMUM_PLANNER_SPEED = 0x00B4; // .. 0x00B5

/// Reset all data in the EEPROM to a default.
void setDefaults();
Expand Down
3 changes: 2 additions & 1 deletion firmware/src/Motherboard/Host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "Tool.hh"
#include "Commands.hh"
#include "Steppers.hh"
#include "Planner.hh"
#include "DebugPacketProcessor.hh"
#include "Timeout.hh"
#include "Version.hh"
Expand Down Expand Up @@ -411,7 +412,7 @@ enum { // bit assignments
inline void handleExtendedStop(const InPacket& from_host, OutPacket& to_host) {
uint8_t flags = from_host.read8(1);
if (flags & _BV(ES_STEPPERS)) {
steppers::abort();
planner::abort();
}
if (flags & _BV(ES_COMMANDS)) {
command::reset();
Expand Down
6 changes: 4 additions & 2 deletions firmware/src/Motherboard/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <util/atomic.h>
#include "Timeout.hh"
#include "Steppers.hh"
#include "Planner.hh"
#include "Motherboard.hh"
#include "SDCard.hh"
#include "Eeprom.hh"
Expand All @@ -33,10 +34,10 @@ void reset(bool hard_reset) {
ATOMIC_BLOCK(ATOMIC_FORCEON) {
Motherboard& board = Motherboard::getBoard();
sdcard::reset();
steppers::abort();
command::reset();
eeprom::init();
board.reset();
board.reset(); // sets up the steps/mm and such for the planner...
planner::abort(); // calls steppers::abort()
sei();
// If we've just come from a hard reset, wait for 2.5 seconds before
// trying to ping an extruder. This gives the extruder time to boot
Expand All @@ -58,6 +59,7 @@ int main() {

Motherboard& board = Motherboard::getBoard();
steppers::init(Motherboard::getBoard());
planner::init();
reset(true);
sei();
while (1) {
Expand Down
Loading