Skip to content

Commit

Permalink
Merge pull request #43 from donovan6000/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
donovan6000 authored Aug 31, 2016
2 parents 7971279 + 895c3c0 commit bb7a2f9
Show file tree
Hide file tree
Showing 17 changed files with 138 additions and 70 deletions.
6 changes: 6 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Changelog:

V00.00.01.18 August 30, 2016

* Sped up movements
* Allows setting the calibrate Z0 correction factor
* Fixed issue where motors could move faster than the feedrate provided by a command. Huge thanks to qwerty8224!

V00.00.01.12 August 17, 2016

* Continually checks if accelerometer and heater are working while they're being used
Expand Down
Binary file modified M33 Manager/M33 Manager Linux.zip
Binary file not shown.
Binary file modified M33 Manager/M33 Manager OS X.zip
Binary file not shown.
Binary file modified M33 Manager/M33 Manager Windows.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion M33 Manager/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PROGRAM_NAME = M33\ Manager
VERSION = 0.10
TARGET_PLATFORM = LINUX64
USE_GUI = TRUE
IME_ROM_VERSION_STRING = 1900000112
IME_ROM_VERSION_STRING = 1900000118
M3D_ROM_VERSION_STRING = 2016040401

SRCS = main.cpp printer.cpp gcode.cpp common.cpp
Expand Down
2 changes: 1 addition & 1 deletion M33 Manager/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3177,7 +3177,7 @@ void MyFrame::checkInvalidValues() {
bool incompatible = true;
if((printer.getFirmwareType() == M3D || printer.getFirmwareType() == M3D_MOD) && stoi(printer.getFirmwareRelease()) >= 2015122112)
incompatible = false;
else if(printer.getFirmwareType() == IME && printer.getFirmwareVersion() >= 1900000112)
else if(printer.getFirmwareType() == IME && printer.getFirmwareVersion() >= 1900000118)
incompatible = false;

// Get iMe version
Expand Down
27 changes: 23 additions & 4 deletions M33 Manager/printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,17 @@ bool Printer::collectPrinterInformation(bool logDetails) {
// Return false
return false;
}

// Check if updating calibrate Z0 correction failed
if(!eepromKeepFloatWithinRange(EEPROM_CALIBRATE_Z0_CORRECTION_OFFSET, EEPROM_CALIBRATE_Z0_CORRECTION_LENGTH, EEPROM_CALIBRATE_Z0_CORRECTION_MIN, EEPROM_CALIBRATE_Z0_CORRECTION_MAX, EEPROM_CALIBRATE_Z0_CORRECTION_DEFAULT)) {

// Log if logging details
if(logFunction && logDetails)
logFunction("Updating calibrate Z0 correction failed");

// Return false
return false;
}
}

// Check if updating last recorded Z value failed
Expand Down Expand Up @@ -1065,6 +1076,7 @@ bool Printer::collectPrinterInformation(bool logDetails) {
float stepsPerMmE = eepromGetFloat(EEPROM_E_MOTOR_STEPS_PER_MM_OFFSET, EEPROM_E_MOTOR_STEPS_PER_MM_LENGTH);
uint8_t xJerkSensitivity = eepromGetInt(EEPROM_X_JERK_SENSITIVITY_OFFSET, EEPROM_X_JERK_SENSITIVITY_LENGTH);
uint8_t yJerkSensitivity = eepromGetInt(EEPROM_Y_JERK_SENSITIVITY_OFFSET, EEPROM_Y_JERK_SENSITIVITY_LENGTH);
float calibrateZ0Correction = eepromGetFloat(EEPROM_CALIBRATE_Z0_CORRECTION_OFFSET, EEPROM_CALIBRATE_Z0_CORRECTION_LENGTH);

// Set if firmware is valid
validFirmware = chipCrc == eepromCrc;
Expand Down Expand Up @@ -1107,6 +1119,7 @@ bool Printer::collectPrinterInformation(bool logDetails) {
logFunction("Using " + to_string(stepsPerMmE) + " E motor steps/mm");
logFunction("Using " + to_string(xJerkSensitivity) + " / " + to_string(EEPROM_X_JERK_SENSITIVITY_MAX) + " X jerk homing sensitivity");
logFunction("Using " + to_string(yJerkSensitivity) + " / " + to_string(EEPROM_Y_JERK_SENSITIVITY_MAX) + " Y jerk homing sensitivity");
logFunction("Using " + to_string(calibrateZ0Correction) + "mm calibrate Z0 correction");
logFunction(static_cast<string>("Firmware is ") + (validFirmware ? "valid" : "corrupt"));
logFunction(static_cast<string>("Bed position is ") + (validBedPosition ? "valid" : "invalid"));
logFunction(static_cast<string>("Bed orientation is ") + (validBedOrientation ? "valid" : "invalid"));
Expand Down Expand Up @@ -1798,20 +1811,20 @@ bool Printer::installFirmware(const string &file) {
logFunction("Successfully saved converted last recorded Z value");
}

// Check if clearing X and Y sensitivity, value, direction, and validity in EEPROM failed
if(!eepromWriteInt(EEPROM_X_JERK_SENSITIVITY_OFFSET, EEPROM_SAVED_Y_STATE_LENGTH + EEPROM_SAVED_Y_STATE_OFFSET - EEPROM_X_JERK_SENSITIVITY_OFFSET, 0)) {
// Check if clearing calibrate Z0 correction and X and Y sensitivity, value, direction, and validity in EEPROM failed
if(!eepromWriteInt(EEPROM_CALIBRATE_Z0_CORRECTION_OFFSET, EEPROM_SAVED_Y_STATE_LENGTH + EEPROM_SAVED_Y_STATE_OFFSET - EEPROM_CALIBRATE_Z0_CORRECTION_OFFSET, 0)) {

// Log error
if(logFunction)
logFunction("Failed to clear X and Y sensitivity, value, direction, and validity");
logFunction("Failed to clear calibrate Z0 correction and X and Y sensitivity, value, direction, and validity");

// Return false
return false;
}

// Log X and Y value, direction, and validity status
if(logFunction)
logFunction("Successfully cleared out X and Y sensitivity, value, direction, and validity");
logFunction("Successfully cleared out calibrate Z0 correction and X and Y sensitivity, value, direction, and validity");

// Check if clearing motor's steps/mm failed
if(!eepromWriteInt(EEPROM_X_MOTOR_STEPS_PER_MM_OFFSET, EEPROM_E_MOTOR_STEPS_PER_MM_LENGTH + EEPROM_E_MOTOR_STEPS_PER_MM_OFFSET - EEPROM_X_MOTOR_STEPS_PER_MM_OFFSET, 0)) {
Expand Down Expand Up @@ -3011,6 +3024,7 @@ vector<string> Printer::getEepromSettingsNames() {
settingsNames.push_back("E motor steps/mm");
settingsNames.push_back("X jerk homing sensitivity");
settingsNames.push_back("Y jerk homing sensitivity");
settingsNames.push_back("Calibrate Z0 correction");

// Return settings names
return settingsNames;
Expand Down Expand Up @@ -3134,6 +3148,11 @@ void Printer::getEepromOffsetLengthAndType(const string &name, uint16_t &offset,
length = EEPROM_Y_JERK_SENSITIVITY_LENGTH;
type = EEPROM_Y_JERK_SENSITIVITY_TYPE;
}
else if(name == "Calibrate Z0 correction") {
offset = EEPROM_CALIBRATE_Z0_CORRECTION_OFFSET;
length = EEPROM_CALIBRATE_Z0_CORRECTION_LENGTH;
type = EEPROM_CALIBRATE_Z0_CORRECTION_TYPE;
}
}

bool Printer::hasValidFirmware() {
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Firmware name and version
FIRMWARE_NAME = iMe
FIRMWARE_VERSION = 00.00.01.12
ROM_VERSION_STRING = 1900000112
FIRMWARE_VERSION = 00.00.01.18
ROM_VERSION_STRING = 1900000118

# Tool locations
ifeq ($(OS), Windows_NT)
Expand Down Expand Up @@ -94,7 +94,7 @@ INCPATH = . \
src/config

# Compiler flags
FLAGS = -D BOARD=USER_BOARD -D FIRMWARE_NAME=$(FIRMWARE_NAME) -D FIRMWARE_VERSION=$(FIRMWARE_VERSION) -Os -mmcu=atxmega32c4 -Wall -Wno-maybe-uninitialized -funsigned-char -funsigned-bitfields -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -fno-strict-aliasing -Werror-implicit-function-declaration -Wpointer-arith -mcall-prologues -mstrict-X -maccumulate-args -fno-tree-ter -mrelax -fno-math-errno -fno-signed-zeros -flto -flto-partition=1to1
FLAGS = -D BOARD=USER_BOARD -D FIRMWARE_NAME=$(FIRMWARE_NAME) -D FIRMWARE_VERSION=$(FIRMWARE_VERSION) -Os -mmcu=atxmega32c4 -Wall -Wno-maybe-uninitialized -funsigned-char -funsigned-bitfields -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -fno-strict-aliasing -Werror-implicit-function-declaration -Wpointer-arith -mcall-prologues -mstrict-X -maccumulate-args -fno-tree-ter -mrelax -fno-math-errno -flto -flto-partition=1to1
ASFLAGS = -std=c++14 -x assembler-with-cpp
CFLAGS = -std=gnu99 -x c -Wstrict-prototypes -Wmissing-prototypes
CPPFLAGS = -std=c++14 -x c++
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Firmware that allows using the Micro 3D printer with third-party 3D printing sof
### Description
iMe is firmware for the Micro 3D printer that attempts to fix the printer's biggest problem: limited software compatibility. iMe uses RepRap G-code protocol, so it allows you to use the Micro 3D printer with any 3D printing software that supports that protocol. It also features builtin backlash and bed compensation which makes creating good looking prints with other software possible since the G-code never has to be pre-processed beforehand.

The latest version of iMe is V00.00.01.12 released on August 17th, 2016, and an entire changelog for it can be found [here](https://raw.githubusercontent.com/donovan6000/iMe/master/Changelog).
The latest version of iMe is V00.00.01.18 released on August 30th, 2016, and an entire changelog for it can be found [here](https://raw.githubusercontent.com/donovan6000/iMe/master/Changelog).

### Features
* Uses RepRap's G-code protocol
Expand Down
6 changes: 6 additions & 0 deletions eeprom.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ enum EEPROM_TYPES {EEPROM_INT, EEPROM_FLOAT, EEPROM_STRING};
#define EEPROM_SPEED_LIMIT_E_NEGATIVE_LENGTH 4
#define EEPROM_BED_ORIENTATION_FIRST_SAMPLE_OFFSET 0x106
#define EEPROM_BED_ORIENTATION_FIRST_SAMPLE_LENGTH 4
#define EEPROM_CALIBRATE_Z0_CORRECTION_OFFSET 0x299
#define EEPROM_CALIBRATE_Z0_CORRECTION_LENGTH 4
#define EEPROM_X_JERK_SENSITIVITY_OFFSET 0x29D
#define EEPROM_X_JERK_SENSITIVITY_LENGTH 1
#define EEPROM_Y_JERK_SENSITIVITY_OFFSET 0x29E
Expand Down Expand Up @@ -161,6 +163,7 @@ enum EEPROM_TYPES {EEPROM_INT, EEPROM_FLOAT, EEPROM_STRING};
#define EEPROM_E_MOTOR_STEPS_PER_MM_TYPE EEPROM_FLOAT
#define EEPROM_X_JERK_SENSITIVITY_TYPE EEPROM_INT
#define EEPROM_Y_JERK_SENSITIVITY_TYPE EEPROM_INT
#define EEPROM_CALIBRATE_Z0_CORRECTION_TYPE EEPROM_FLOAT

// EEPROM default values
#define EEPROM_BACKLASH_X_DEFAULT 0.3
Expand Down Expand Up @@ -189,6 +192,7 @@ enum EEPROM_TYPES {EEPROM_INT, EEPROM_FLOAT, EEPROM_STRING};
#define EEPROM_E_MOTOR_STEPS_PER_MM_DEFAULT 128.451375
#define EEPROM_X_JERK_SENSITIVITY_DEFAULT 195
#define EEPROM_Y_JERK_SENSITIVITY_DEFAULT 195
#define EEPROM_CALIBRATE_Z0_CORRECTION_DEFAULT 0.0

// EEPROM min and max values
#define EEPROM_BACKLASH_X_MIN 0.0
Expand Down Expand Up @@ -243,6 +247,8 @@ enum EEPROM_TYPES {EEPROM_INT, EEPROM_FLOAT, EEPROM_STRING};
#define EEPROM_X_JERK_SENSITIVITY_MAX 255
#define EEPROM_Y_JERK_SENSITIVITY_MIN 1
#define EEPROM_Y_JERK_SENSITIVITY_MAX 255
#define EEPROM_CALIBRATE_Z0_CORRECTION_MIN -FLT_MAX
#define EEPROM_CALIBRATE_Z0_CORRECTION_MAX FLT_MAX


#endif
2 changes: 1 addition & 1 deletion gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void Gcode::parseCommand(const char *command) {
for(; *lastValidCharacter && *lastValidCharacter != ';' && *lastValidCharacter != '*' && *lastValidCharacter != '\n'; lastValidCharacter++);

// Remove trailing white space
for(lastValidCharacter--; (lastValidCharacter >= firstValidCharacter) && isspace(*lastValidCharacter); lastValidCharacter--);
for(lastValidCharacter--; lastValidCharacter >= firstValidCharacter && isspace(*lastValidCharacter); lastValidCharacter--);

// Check if command is empty
if(++lastValidCharacter != firstValidCharacter) {
Expand Down
2 changes: 1 addition & 1 deletion heater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ bool Heater::setTemperature(uint16_t value, bool wait) {
// Set if newer temperature is lower
bool lowerNewValue = value < getTemperature();

// Turn on/off heater depending on new temperature
// Turn on or off heater depending on new temperature
ioport_set_pin_level(HEATER_MODE_SELECT_PIN, lowerNewValue ? HEATER_OFF : HEATER_ON);

// Wait until temperature has been reached
Expand Down
Binary file removed iMe 1900000112.hex
Binary file not shown.
Binary file added iMe 1900000118.hex
Binary file not shown.
22 changes: 14 additions & 8 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,14 @@ int main() {
case 115:

// Check if command is to reset
if(requests[currentProcessingRequest].commandParameters & PARAMETER_S_OFFSET && requests[currentProcessingRequest].valueS == 628)

if(requests[currentProcessingRequest].commandParameters & PARAMETER_S_OFFSET && requests[currentProcessingRequest].valueS == 628) {

// Disable interrupts
cpu_irq_disable();

// Reset
reset_do_soft_reset();
}

// Otherwise
else {
Expand Down Expand Up @@ -816,8 +820,8 @@ int main() {
// Check if command has an N parameter and it was processed
if(requests[currentProcessingRequest].commandParameters & PARAMETER_N_OFFSET && (!strncmp(responseBuffer, "ok", strlen("ok")) || !strncmp(responseBuffer, "rs", strlen("rs")) || !strncmp(responseBuffer, "skip", strlen("skip")))) {

// Check if response is a confirmation and current command number isn't at its max
if(!strncmp(responseBuffer, "ok", strlen("ok")) && currentCommandNumber != UINT64_MAX)
// Check if response is a confirmation
if(!strncmp(responseBuffer, "ok", strlen("ok")))

// Increment current command number
currentCommandNumber++;
Expand Down Expand Up @@ -916,7 +920,7 @@ void cdcRxNotifyCallback(uint8_t port) {
if(!emergencyStopOccured) {

// Go through all commands in request
for(char *offset = accumulatedBuffer; *offset;) {
for(char *offset = accumulatedBuffer; *offset; offset++) {

// Parse request
Gcode gcode;
Expand All @@ -942,9 +946,11 @@ void cdcRxNotifyCallback(uint8_t port) {
currentReceivingRequest = currentReceivingRequest == REQUEST_BUFFER_SIZE - 1 ? 0 : currentReceivingRequest + 1;
}

// Go to next command
if(*(offset = strchr(offset, '\n')))
offset++;
// Check if next command doesn't exist
if(!(offset = strchr(offset, '\n')))

// Break
break;
}
}
}
Expand Down
Loading

0 comments on commit bb7a2f9

Please sign in to comment.