Skip to content

Commit

Permalink
Merge pull request #29 from donovan6000/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
donovan6000 authored Jul 29, 2016
2 parents ee5a60d + 3435c4b commit 88e23f6
Show file tree
Hide file tree
Showing 31 changed files with 518 additions and 363 deletions.
9 changes: 9 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
Changelog:

V00.00.01.06 July 28, 2016

* First non-alpha release of iMe. Huge thanks to everyone who contributed!
* Compiled with the latest Atmel Software Framework V3.32
* Uses intrinsic delays
* Fixed accumulating rounding error that occurs due moving a fractional number of steps
* Decreased homing accelerometer sensitivity
* Allows setting the steps/mm for each of the motors

V00.00.00.12 July 20, 2016

* Sped up movements
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.
4 changes: 2 additions & 2 deletions M33 Manager/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Target platform options: WINDOWS32, WINDOWS64, OSX32, OSX64, LINUX32, LINUX64
PROGRAM_NAME = M33\ Manager
VERSION = 0.07
VERSION = 0.08
TARGET_PLATFORM = LINUX64
USE_GUI = TRUE
IME_ROM_VERSION_STRING = 1900000012
IME_ROM_VERSION_STRING = 1900000106
M3D_ROM_VERSION_STRING = 2016040401

SRCS = main.cpp printer.cpp gcode.cpp common.cpp
Expand Down
8 changes: 4 additions & 4 deletions M33 Manager/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2708,7 +2708,7 @@ void MyFrame::checkInvalidValues() {
if(!printer.hasValidBedOrientation()) {

// Display bed orientation calibration dialog
wxMessageDialog *dial = new wxMessageDialog(NULL, "Bed orientation is invalid. Calibrate?", "M33 Manager", wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION);
wxMessageDialog *dial = new wxMessageDialog(nullptr, "Bed orientation is invalid. Calibrate?", "M33 Manager", wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION);

// Check if calibrating bed orientation
if(dial->ShowModal() == wxID_YES) {
Expand Down Expand Up @@ -2894,7 +2894,7 @@ void MyFrame::checkInvalidValues() {
if(!printer.hasValidBedPosition()) {

// Display bed position calibration dialog
wxMessageDialog *dial = new wxMessageDialog(NULL, "Bed position is invalid. Calibrate?", "M33 Manager", wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION);
wxMessageDialog *dial = new wxMessageDialog(nullptr, "Bed position is invalid. Calibrate?", "M33 Manager", wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION);

// Check if calibrating bed position
if(dial->ShowModal() == wxID_YES) {
Expand Down Expand Up @@ -3083,7 +3083,7 @@ void MyFrame::checkInvalidValues() {
iMeVersion.insert(i * 2 + 2 + i, ".");

// Display firmware installation dialog
wxMessageDialog *dial = new wxMessageDialog(NULL, "Firmware is corrupt. Install " + (printer.getFirmwareType() == M3D || printer.getFirmwareType() == M3D_MOD ? "M3D V" TOSTRING(M3D_ROM_VERSION_STRING) : "iMe V" + iMeVersion) + "?", "M33 Manager", wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION);
wxMessageDialog *dial = new wxMessageDialog(nullptr, "Firmware is corrupt. Install " + (printer.getFirmwareType() == M3D || printer.getFirmwareType() == M3D_MOD ? "M3D V" TOSTRING(M3D_ROM_VERSION_STRING) : "iMe V" + iMeVersion) + "?", "M33 Manager", wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION);

// Check if installing firmware
if(dial->ShowModal() == wxID_YES) {
Expand Down Expand Up @@ -3167,7 +3167,7 @@ void MyFrame::checkInvalidValues() {
iMeVersion.insert(i * 2 + 2 + i, ".");

// Display firmware installation dialog
wxMessageDialog *dial = new wxMessageDialog(NULL, static_cast<string>(incompatible ? "Firmware is incompatible" : "Newer firmware available") + ". Update to " + (printer.getFirmwareType() == M3D || printer.getFirmwareType() == M3D_MOD ? "M3D V" TOSTRING(M3D_ROM_VERSION_STRING) : "iMe V" + iMeVersion) + "?", "M33 Manager", wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION);
wxMessageDialog *dial = new wxMessageDialog(nullptr, static_cast<string>(incompatible ? "Firmware is incompatible" : "Newer firmware available") + ". Update to " + (printer.getFirmwareType() == M3D || printer.getFirmwareType() == M3D_MOD ? "M3D V" TOSTRING(M3D_ROM_VERSION_STRING) : "iMe V" + iMeVersion) + "?", "M33 Manager", wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION);

// Check if installing firmware
if(dial->ShowModal() == wxID_YES) {
Expand Down
2 changes: 1 addition & 1 deletion M33 Manager/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ bool installFirmware(const string &firmwareLocation, const string &serialPort);
#endif

// Create and show window
MyFrame *frame = new MyFrame("M33 Manager", wxDefaultPosition, wxSize(559, 482), wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxMAXIMIZE_BOX));
MyFrame *frame = new MyFrame("M33 Manager", wxDefaultPosition, wxSize(1118, 482), wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxMAXIMIZE_BOX));
frame->Center();
frame->Show(true);

Expand Down
181 changes: 127 additions & 54 deletions M33 Manager/printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,50 @@ bool Printer::collectPrinterInformation(bool logDetails) {
// Return false
return false;
}

// Check if updating X motor steps/mm failed
if(!eepromKeepFloatWithinRange(EEPROM_X_MOTOR_STEPS_PER_MM_OFFSET, EEPROM_X_MOTOR_STEPS_PER_MM_LENGTH, EEPROM_X_MOTOR_STEPS_PER_MM_MIN, EEPROM_X_MOTOR_STEPS_PER_MM_MAX, EEPROM_X_MOTOR_STEPS_PER_MM_DEFAULT)) {

// Log if logging details
if(logFunction && logDetails)
logFunction("Updating X motor steps/mm failed");

// Return false
return false;
}

// Check if updating Y motor steps/mm failed
if(!eepromKeepFloatWithinRange(EEPROM_Y_MOTOR_STEPS_PER_MM_OFFSET, EEPROM_Y_MOTOR_STEPS_PER_MM_LENGTH, EEPROM_Y_MOTOR_STEPS_PER_MM_MIN, EEPROM_Y_MOTOR_STEPS_PER_MM_MAX, EEPROM_Y_MOTOR_STEPS_PER_MM_DEFAULT)) {

// Log if logging details
if(logFunction && logDetails)
logFunction("Updating Y motor steps/mm failed");

// Return false
return false;
}

// Check if updating Z motor steps/mm failed
if(!eepromKeepFloatWithinRange(EEPROM_Z_MOTOR_STEPS_PER_MM_OFFSET, EEPROM_Z_MOTOR_STEPS_PER_MM_LENGTH, EEPROM_Z_MOTOR_STEPS_PER_MM_MIN, EEPROM_Z_MOTOR_STEPS_PER_MM_MAX, EEPROM_Z_MOTOR_STEPS_PER_MM_DEFAULT)) {

// Log if logging details
if(logFunction && logDetails)
logFunction("Updating Z motor steps/mm failed");

// Return false
return false;
}

// Check if updating E motor steps/mm failed
if(!eepromKeepFloatWithinRange(EEPROM_E_MOTOR_STEPS_PER_MM_OFFSET, EEPROM_E_MOTOR_STEPS_PER_MM_LENGTH, EEPROM_E_MOTOR_STEPS_PER_MM_MIN, EEPROM_E_MOTOR_STEPS_PER_MM_MAX, EEPROM_E_MOTOR_STEPS_PER_MM_DEFAULT)) {

// Log if logging details
if(logFunction && logDetails)
logFunction("Updating E motor steps/mm failed");

// Return false
return false;
}
}

// Check if updating last recorded Z value failed
Expand Down Expand Up @@ -994,6 +1038,10 @@ bool Printer::collectPrinterInformation(bool logDetails) {
uint8_t heaterCalibrationMode = eepromGetInt(EEPROM_HEATER_CALIBRATION_MODE_OFFSET, EEPROM_HEATER_CALIBRATION_MODE_LENGTH);
float heaterTemperatureMeasurementB = eepromGetFloat(EEPROM_HEATER_TEMPERATURE_MEASUREMENT_B_OFFSET, EEPROM_HEATER_TEMPERATURE_MEASUREMENT_B_LENGTH);
float heaterResistanceM = eepromGetFloat(EEPROM_HEATER_RESISTANCE_M_OFFSET, EEPROM_HEATER_RESISTANCE_M_LENGTH);
float stepsPerMmX = eepromGetFloat(EEPROM_X_MOTOR_STEPS_PER_MM_OFFSET, EEPROM_X_MOTOR_STEPS_PER_MM_LENGTH);
float stepsPerMmY = eepromGetFloat(EEPROM_Y_MOTOR_STEPS_PER_MM_OFFSET, EEPROM_Y_MOTOR_STEPS_PER_MM_LENGTH);
float stepsPerMmZ = eepromGetFloat(EEPROM_Z_MOTOR_STEPS_PER_MM_OFFSET, EEPROM_Z_MOTOR_STEPS_PER_MM_LENGTH);
float stepsPerMmE = eepromGetFloat(EEPROM_E_MOTOR_STEPS_PER_MM_OFFSET, EEPROM_E_MOTOR_STEPS_PER_MM_LENGTH);

// Set if firmware is valid
validFirmware = chipCrc == eepromCrc;
Expand Down Expand Up @@ -1030,6 +1078,10 @@ bool Printer::collectPrinterInformation(bool logDetails) {
logFunction("Using heater calibration mode " + to_string(heaterCalibrationMode));
logFunction("Using " + to_string(heaterTemperatureMeasurementB) + " heater temperature measurement B");
logFunction("Using " + to_string(heaterResistanceM) + " heater resistance M");
logFunction("Using " + to_string(stepsPerMmX) + " X motor steps/mm");
logFunction("Using " + to_string(stepsPerMmY) + " Y motor steps/mm");
logFunction("Using " + to_string(stepsPerMmZ) + " Z motor steps/mm");
logFunction("Using " + to_string(stepsPerMmE) + " E motor steps/mm");
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 @@ -1645,11 +1697,8 @@ bool Printer::installFirmware(const string &file) {
if(logFunction)
logFunction("Obtained EEPROM");

// Get old EEPROM CRC
uint32_t oldEepromCrc = eepromGetInt(EEPROM_FIRMWARE_CRC_OFFSET, EEPROM_FIRMWARE_CRC_LENGTH);

// Check if last Z recorded is invalid or previous firmware was corrupt
if(!eepromGetInt(EEPROM_SAVED_Z_STATE_OFFSET, EEPROM_SAVED_Z_STATE_LENGTH) || oldFirmwareCrc != oldEepromCrc) {
// Check if last Z recorded is invalid
if(!eepromGetInt(EEPROM_SAVED_Z_STATE_OFFSET, EEPROM_SAVED_Z_STATE_LENGTH)) {

// Check if clearing last recorded Z value in EEPROM failed
if(!eepromWriteInt(EEPROM_LAST_RECORDED_Z_VALUE_OFFSET, EEPROM_LAST_RECORDED_Z_VALUE_LENGTH, 0)) {
Expand All @@ -1667,89 +1716,93 @@ bool Printer::installFirmware(const string &file) {
logFunction("Successfully cleared out last recorded Z value");
}

// Otherwise
else {
// Get old firmware type
firmwareTypes oldFirmwareType = getFirmwareTypeFromFirmwareVersion(eepromGetInt(EEPROM_FIRMWARE_VERSION_OFFSET, EEPROM_FIRMWARE_VERSION_LENGTH));

// Get new firmware type
firmwareTypes newFirmwareType = getFirmwareTypeFromFirmwareVersion(romVersion);

// Check if going from M3D or M3D Mod firmware to iMe firmware
if((oldFirmwareType == M3D || oldFirmwareType == M3D_MOD) && newFirmwareType == IME) {

// Check if last Z recorded is valid
if(eepromGetInt(EEPROM_SAVED_Z_STATE_OFFSET, EEPROM_SAVED_Z_STATE_LENGTH)) {

// Get old firmware type
firmwareTypes oldFirmwareType = getFirmwareTypeFromFirmwareVersion(eepromGetInt(EEPROM_FIRMWARE_VERSION_OFFSET, EEPROM_FIRMWARE_VERSION_LENGTH));

// Get new firmware type
firmwareTypes newFirmwareType = getFirmwareTypeFromFirmwareVersion(romVersion);

// Check if going from M3D or M3D Mod firmware to iMe firmware
if((oldFirmwareType == M3D || oldFirmwareType == M3D_MOD) && newFirmwareType == IME) {

// Convert last recorded Z value to single-precision floating-point format used by iMe firmware
float lastRecordedZValue = eepromGetInt(EEPROM_LAST_RECORDED_Z_VALUE_OFFSET, EEPROM_LAST_RECORDED_Z_VALUE_LENGTH) / M3D_FIRMWARE_FLOAT_TO_INT_SCALAR;

// Check if saving last recorded Z value in EEPROM failed
if(!eepromWriteFloat(EEPROM_LAST_RECORDED_Z_VALUE_OFFSET, EEPROM_LAST_RECORDED_Z_VALUE_LENGTH, lastRecordedZValue)) {

// Log error
if(logFunction)
logFunction("Failed to save converted last recorded Z value");

// Return false
return false;
}

// Log last recorded Z value status
if(logFunction)
logFunction("Successfully saved converted last recorded Z value");
}

// Otherwise check if going from iMe firmware to M3D or M3D Mod firmware
else if(oldFirmwareType == IME && (newFirmwareType == M3D || newFirmwareType == M3D_MOD)) {

}

// Otherwise check if going from iMe firmware to M3D or M3D Mod firmware
else if(oldFirmwareType == IME && (newFirmwareType == M3D || newFirmwareType == M3D_MOD)) {

// Check if last Z recorded is valid
if(eepromGetInt(EEPROM_SAVED_Z_STATE_OFFSET, EEPROM_SAVED_Z_STATE_LENGTH)) {

// Convert last recorded Z value to unsigned 32-bit integer format used by M3D and M3D Mod firmwares
uint32_t lastRecordedZValue = round(eepromGetFloat(EEPROM_LAST_RECORDED_Z_VALUE_OFFSET, EEPROM_LAST_RECORDED_Z_VALUE_LENGTH) * M3D_FIRMWARE_FLOAT_TO_INT_SCALAR);

// Check if saving last recorded Z value in EEPROM failed
if(!eepromWriteInt(EEPROM_LAST_RECORDED_Z_VALUE_OFFSET, EEPROM_LAST_RECORDED_Z_VALUE_LENGTH, lastRecordedZValue)) {

// Log error
if(logFunction)
logFunction("Failed to save converted last recorded Z value");

// Return false
return false;
}

// Log last recorded Z value status
if(logFunction)
logFunction("Successfully saved converted last recorded Z value");

// Check if clearing X and Y value, direction, and validity in EEPROM failed
if(!eepromWriteInt(EEPROM_LAST_RECORDED_X_VALUE_OFFSET, EEPROM_SAVED_Y_STATE_LENGTH + EEPROM_SAVED_Y_STATE_OFFSET - EEPROM_LAST_RECORDED_X_VALUE_OFFSET, 0)) {

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

// Return false
return false;
}
}

// Log X and Y validity status
// Check if clearing X and Y value, direction, and validity in EEPROM failed
if(!eepromWriteInt(EEPROM_LAST_RECORDED_X_VALUE_OFFSET, EEPROM_SAVED_Y_STATE_LENGTH + EEPROM_SAVED_Y_STATE_OFFSET - EEPROM_LAST_RECORDED_X_VALUE_OFFSET, 0)) {

// Log error
if(logFunction)
logFunction("Successfully cleared out X and Y value, direction, and validity");
logFunction("Failed to clear X and Y value, direction, and validity");

// Return false
return false;
}
}

// Check if clearing motor's steps per mm failed
if(!eepromWriteInt(EEPROM_X_AXIS_STEPS_PER_MM_OFFSET, EEPROM_E_AXIS_STEPS_PER_MM_LENGTH + EEPROM_E_AXIS_STEPS_PER_MM_OFFSET - EEPROM_X_AXIS_STEPS_PER_MM_OFFSET, 0)) {

// Log error

// Log X and Y value, direction, and validity status
if(logFunction)
logFunction("Failed to clear out motor's steps per mm");
logFunction("Successfully cleared out X and Y 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)) {

// Return false
return false;
// Log error
if(logFunction)
logFunction("Failed to clear out motor's steps/mm");

// Return false
return false;
}

// Log operation status
if(logFunction)
logFunction("Successfully cleared out motor's steps/mm");
}

// Log operation status
if(logFunction)
logFunction("Successfully cleared out motor's steps per mm");

// Check if updating firmware version in EEPROM failed
if(!eepromWriteInt(EEPROM_FIRMWARE_VERSION_OFFSET, EEPROM_FIRMWARE_VERSION_LENGTH, romVersion)) {
Expand Down Expand Up @@ -2914,6 +2967,10 @@ vector<string> Printer::getEepromSettingsNames() {
settingsNames.push_back("Speed limit Z");
settingsNames.push_back("Speed limit E+");
settingsNames.push_back("Speed limit E-");
settingsNames.push_back("X motor steps/mm");
settingsNames.push_back("Y motor steps/mm");
settingsNames.push_back("Z motor steps/mm");
settingsNames.push_back("E motor steps/mm");

// Return settings names
return settingsNames;
Expand Down Expand Up @@ -2990,6 +3047,22 @@ void Printer::getEepromOffsetAndLength(const string &name, uint16_t &offset, uin
offset = EEPROM_SPEED_LIMIT_E_NEGATIVE_OFFSET;
length = EEPROM_SPEED_LIMIT_E_NEGATIVE_LENGTH;
}
else if(name == "X motor steps/mm") {
offset = EEPROM_X_MOTOR_STEPS_PER_MM_OFFSET;
length = EEPROM_X_MOTOR_STEPS_PER_MM_LENGTH;
}
else if(name == "Y motor steps/mm") {
offset = EEPROM_Y_MOTOR_STEPS_PER_MM_OFFSET;
length = EEPROM_Y_MOTOR_STEPS_PER_MM_LENGTH;
}
else if(name == "Z motor steps/mm") {
offset = EEPROM_Z_MOTOR_STEPS_PER_MM_OFFSET;
length = EEPROM_Z_MOTOR_STEPS_PER_MM_LENGTH;
}
else if(name == "E motor steps/mm") {
offset = EEPROM_E_MOTOR_STEPS_PER_MM_OFFSET;
length = EEPROM_E_MOTOR_STEPS_PER_MM_LENGTH;
}
}

bool Printer::hasValidFirmware() {
Expand Down
4 changes: 2 additions & 2 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.00.12
ROM_VERSION_STRING = 1900000012
FIRMWARE_VERSION = 00.00.01.06
ROM_VERSION_STRING = 1900000106

# Tool locations
ifeq ($(OS), Windows_NT)
Expand Down
3 changes: 2 additions & 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.00.12 released on July 20th, 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.06 released on July 28th, 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 All @@ -15,6 +15,7 @@ The latest version of iMe is V00.00.00.12 released on July 20th, 2016, and an en
* Builtin backlash and bed compensation
* Prevents moving the extruder out of bounds in the X and Y directions
* Faster printing
* Allows configuring the steps/mm for each of the motors

### Installation
The easiest way to install iMe is with M33 Manager, which is available for [Windows](https://raw.githubusercontent.com/donovan6000/iMe/master/M33%20Manager/M33%20Manager%20Windows.zip), [OS X](https://raw.githubusercontent.com/donovan6000/iMe/master/M33%20Manager/M33%20Manager%20OS%20X.zip), and [Linux](https://raw.githubusercontent.com/donovan6000/iMe/master/M33%20Manager/M33%20Manager%20Linux.zip). Just connect the printer to M33 Manager and click the 'Install iMe firmware' button to install iMe.
Expand Down
2 changes: 1 addition & 1 deletion accelerometer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void Accelerometer::initialize() {
writeValue(CTRL_REG2, CTRL_REG2_RST);

// Wait enough time for accelerometer to initialize
delay_ms(1);
delay_ms(2);

// Put accelerometer into standby mode
writeValue(CTRL_REG1, 0);
Expand Down
4 changes: 2 additions & 2 deletions accelerometer.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@


// Definitions
#define X_JERK_ACCELERATION 39
#define Y_JERK_ACCELERATION 38
#define X_JERK_ACCELERATION 60
#define Y_JERK_ACCELERATION 90
#define Y_TILT_ACCELERATION 10


Expand Down
Loading

0 comments on commit 88e23f6

Please sign in to comment.